diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index 4a15c50d3d0..06e66abc828 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -86,6 +86,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Analytics_service.export_analytics_metrics | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js,packages/google-cloud-retail/samples/README.md) | | Catalog_service.add_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js,packages/google-cloud-retail/samples/README.md) | | Catalog_service.get_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-retail/samples/generated/v2/catalog_service.get_attributes_config.js,packages/google-cloud-retail/samples/README.md) | | Catalog_service.get_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-retail/samples/generated/v2/catalog_service.get_completion_config.js,packages/google-cloud-retail/samples/README.md) | diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/analytics_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/analytics_service.proto new file mode 100644 index 00000000000..2b1f0bce3f2 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/analytics_service.proto @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/export_config.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "cloud.google.com/go/retail/apiv2/retailpb;retailpb"; +option java_multiple_files = true; +option java_outer_classname = "AnalyticsServiceProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// Service for managing & accessing retail search business metric. +// Retail recommendation business metric is currently not available. +service AnalyticsService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Exports analytics metrics. + // + // `Operation.response` is of type `ExportAnalyticsMetricsResponse`. + // `Operation.metadata` is of type `ExportMetadata`. + rpc ExportAnalyticsMetrics(ExportAnalyticsMetricsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.ExportAnalyticsMetricsResponse" + metadata_type: "google.cloud.retail.v2.ExportMetadata" + }; + } +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/export_config.proto new file mode 100644 index 00000000000..fe12c1fcd1f --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/export_config.proto @@ -0,0 +1,161 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.retail.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2"; +option go_package = "cloud.google.com/go/retail/apiv2/retailpb;retailpb"; +option java_multiple_files = true; +option java_outer_classname = "ExportConfigProto"; +option java_package = "com.google.cloud.retail.v2"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2"; +option ruby_package = "Google::Cloud::Retail::V2"; + +// The output configuration setting. +message OutputConfig { + // The Google Cloud Storage output destination configuration. + message GcsDestination { + // Required. The output uri prefix for saving output data to json files. + // Some mapping examples are as follows: + // output_uri_prefix sample output(assuming the object is foo.json) + // ======================== ============================================= + // gs://bucket/ gs://bucket/foo.json + // gs://bucket/folder/ gs://bucket/folder/foo.json + // gs://bucket/folder/item_ gs://bucket/folder/item_foo.json + string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The BigQuery output destination configuration. + message BigQueryDestination { + // Required. The ID of a BigQuery Dataset. + string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The prefix of exported BigQuery tables. + string table_id_prefix = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Describes the table type. The following values are supported: + // + // * `table`: A BigQuery native table. + // * `view`: A virtual table defined by a SQL query. + string table_type = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // The configuration of destination for holding output data. + oneof destination { + // The Google Cloud Storage location where the output is to be written to. + GcsDestination gcs_destination = 1; + + // The BigQuery location where the output is to be written to. + BigQueryDestination bigquery_destination = 2; + } +} + +// Configuration of destination for Export related errors. +message ExportErrorsConfig { + // Required. Errors destination. + oneof destination { + // Google Cloud Storage path for import errors. This must be an empty, + // existing Cloud Storage bucket. Export errors will be written to a file in + // this bucket, one per line, as a JSON-encoded + // `google.rpc.Status` message. + string gcs_prefix = 1; + } +} + +// Request message for the `ExportAnalyticsMetrics` method. +message ExportAnalyticsMetricsRequest { + // Required. Full resource name of the parent catalog. + // Expected format: `projects/*/locations/*/catalogs/*` + string catalog = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The output location of the data. + OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // A filtering expression to specify restrictions on returned metrics. + // The expression is a sequence of terms. Each term applies a restriction to + // the returned metrics. Use this expression to restrict results to a + // specific time range. + // + // Currently we expect only one types of fields: + // + // * `timestamp`: This can be specified twice, once with a + // less than operator and once with a greater than operator. The + // `timestamp` restriction should result in one, contiguous, valid, + // `timestamp` range. + // + // Some examples of valid filters expressions: + // + // * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" + // timestamp < "2012-04-23T18:30:43.511Z"` + // * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` + string filter = 3; +} + +// Metadata related to the progress of the Export operation. This is +// returned by the google.longrunning.Operation.metadata field. +message ExportMetadata { + // Operation create time. + google.protobuf.Timestamp create_time = 1; + + // Operation last update time. If the operation is done, this is also the + // finish time. + google.protobuf.Timestamp update_time = 2; +} + +// Response of the ExportAnalyticsMetricsRequest. If the long running +// operation was successful, then this message is returned by the +// google.longrunning.Operations.response field if the operation was successful. +message ExportAnalyticsMetricsResponse { + // A sample of errors encountered while processing the request. + repeated google.rpc.Status error_samples = 1; + + // This field is never set. + ExportErrorsConfig errors_config = 2; + + // Output result indicating where the data were exported to. + OutputResult output_result = 3; +} + +// Output result that stores the information about where the exported data is +// stored. +message OutputResult { + // The BigQuery location where the result is stored. + repeated BigQueryOutputResult bigquery_result = 1; + + // The Google Cloud Storage location where the result is stored. + repeated GcsOutputResult gcs_result = 2; +} + +// A BigQuery output result. +message BigQueryOutputResult { + // The ID of a BigQuery Dataset. + string dataset_id = 1; + + // The ID of a BigQuery Table. + string table_id = 2; +} + +// A Gcs output result. +message GcsOutputResult { + // The uri of Gcs output + string output_uri = 1; +} diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 0af9badf5f2..b9d0af02fea 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -26,6 +26,1090 @@ export namespace google { /** Namespace v2. */ namespace v2 { + /** Represents an AnalyticsService */ + class AnalyticsService extends $protobuf.rpc.Service { + + /** + * Constructs a new AnalyticsService 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 AnalyticsService 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): AnalyticsService; + + /** + * Calls ExportAnalyticsMetrics. + * @param request ExportAnalyticsMetricsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportAnalyticsMetrics(request: google.cloud.retail.v2.IExportAnalyticsMetricsRequest, callback: google.cloud.retail.v2.AnalyticsService.ExportAnalyticsMetricsCallback): void; + + /** + * Calls ExportAnalyticsMetrics. + * @param request ExportAnalyticsMetricsRequest message or plain object + * @returns Promise + */ + public exportAnalyticsMetrics(request: google.cloud.retail.v2.IExportAnalyticsMetricsRequest): Promise; + } + + namespace AnalyticsService { + + /** + * Callback as used by {@link google.cloud.retail.v2.AnalyticsService|exportAnalyticsMetrics}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportAnalyticsMetricsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an OutputConfig. */ + interface IOutputConfig { + + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.retail.v2.OutputConfig.IGcsDestination|null); + + /** OutputConfig bigqueryDestination */ + bigqueryDestination?: (google.cloud.retail.v2.OutputConfig.IBigQueryDestination|null); + } + + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { + + /** + * Constructs a new OutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IOutputConfig); + + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.retail.v2.OutputConfig.IGcsDestination|null); + + /** OutputConfig bigqueryDestination. */ + public bigqueryDestination?: (google.cloud.retail.v2.OutputConfig.IBigQueryDestination|null); + + /** OutputConfig destination. */ + public destination?: ("gcsDestination"|"bigqueryDestination"); + + /** + * Creates a new OutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IOutputConfig): google.cloud.retail.v2.OutputConfig; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.OutputConfig; + + /** + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.OutputConfig; + + /** + * Verifies an OutputConfig message. + * @param message Plain 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 OutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.OutputConfig; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @param message OutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace OutputConfig { + + /** Properties of a GcsDestination. */ + interface IGcsDestination { + + /** GcsDestination outputUriPrefix */ + outputUriPrefix?: (string|null); + } + + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { + + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.OutputConfig.IGcsDestination); + + /** GcsDestination outputUriPrefix. */ + public outputUriPrefix: string; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.retail.v2.OutputConfig.IGcsDestination): google.cloud.retail.v2.OutputConfig.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.OutputConfig.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.OutputConfig.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.OutputConfig.GcsDestination; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.OutputConfig.GcsDestination; + + /** + * Verifies a GcsDestination message. + * @param message Plain 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 GcsDestination message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDestination + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.OutputConfig.GcsDestination; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @param message GcsDestination + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.OutputConfig.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDestination to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsDestination + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BigQueryDestination. */ + interface IBigQueryDestination { + + /** BigQueryDestination datasetId */ + datasetId?: (string|null); + + /** BigQueryDestination tableIdPrefix */ + tableIdPrefix?: (string|null); + + /** BigQueryDestination tableType */ + tableType?: (string|null); + } + + /** Represents a BigQueryDestination. */ + class BigQueryDestination implements IBigQueryDestination { + + /** + * Constructs a new BigQueryDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.OutputConfig.IBigQueryDestination); + + /** BigQueryDestination datasetId. */ + public datasetId: string; + + /** BigQueryDestination tableIdPrefix. */ + public tableIdPrefix: string; + + /** BigQueryDestination tableType. */ + public tableType: string; + + /** + * Creates a new BigQueryDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQueryDestination instance + */ + public static create(properties?: google.cloud.retail.v2.OutputConfig.IBigQueryDestination): google.cloud.retail.v2.OutputConfig.BigQueryDestination; + + /** + * Encodes the specified BigQueryDestination message. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.BigQueryDestination.verify|verify} messages. + * @param message BigQueryDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.OutputConfig.IBigQueryDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQueryDestination message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.BigQueryDestination.verify|verify} messages. + * @param message BigQueryDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.OutputConfig.IBigQueryDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQueryDestination message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQueryDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.OutputConfig.BigQueryDestination; + + /** + * Decodes a BigQueryDestination message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQueryDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.OutputConfig.BigQueryDestination; + + /** + * Verifies a BigQueryDestination message. + * @param message Plain 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 BigQueryDestination message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQueryDestination + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.OutputConfig.BigQueryDestination; + + /** + * Creates a plain object from a BigQueryDestination message. Also converts values to other types if specified. + * @param message BigQueryDestination + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.OutputConfig.BigQueryDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQueryDestination to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQueryDestination + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExportErrorsConfig. */ + interface IExportErrorsConfig { + + /** ExportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ExportErrorsConfig. */ + class ExportErrorsConfig implements IExportErrorsConfig { + + /** + * Constructs a new ExportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IExportErrorsConfig); + + /** ExportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ExportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IExportErrorsConfig): google.cloud.retail.v2.ExportErrorsConfig; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ExportErrorsConfig; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ExportErrorsConfig; + + /** + * Verifies an ExportErrorsConfig message. + * @param message Plain 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 ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ExportErrorsConfig; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @param message ExportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportAnalyticsMetricsRequest. */ + interface IExportAnalyticsMetricsRequest { + + /** ExportAnalyticsMetricsRequest catalog */ + catalog?: (string|null); + + /** ExportAnalyticsMetricsRequest outputConfig */ + outputConfig?: (google.cloud.retail.v2.IOutputConfig|null); + + /** ExportAnalyticsMetricsRequest filter */ + filter?: (string|null); + } + + /** Represents an ExportAnalyticsMetricsRequest. */ + class ExportAnalyticsMetricsRequest implements IExportAnalyticsMetricsRequest { + + /** + * Constructs a new ExportAnalyticsMetricsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IExportAnalyticsMetricsRequest); + + /** ExportAnalyticsMetricsRequest catalog. */ + public catalog: string; + + /** ExportAnalyticsMetricsRequest outputConfig. */ + public outputConfig?: (google.cloud.retail.v2.IOutputConfig|null); + + /** ExportAnalyticsMetricsRequest filter. */ + public filter: string; + + /** + * Creates a new ExportAnalyticsMetricsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAnalyticsMetricsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IExportAnalyticsMetricsRequest): google.cloud.retail.v2.ExportAnalyticsMetricsRequest; + + /** + * Encodes the specified ExportAnalyticsMetricsRequest message. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsRequest.verify|verify} messages. + * @param message ExportAnalyticsMetricsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IExportAnalyticsMetricsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAnalyticsMetricsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsRequest.verify|verify} messages. + * @param message ExportAnalyticsMetricsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IExportAnalyticsMetricsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAnalyticsMetricsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAnalyticsMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ExportAnalyticsMetricsRequest; + + /** + * Decodes an ExportAnalyticsMetricsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAnalyticsMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ExportAnalyticsMetricsRequest; + + /** + * Verifies an ExportAnalyticsMetricsRequest message. + * @param message Plain 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 ExportAnalyticsMetricsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAnalyticsMetricsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ExportAnalyticsMetricsRequest; + + /** + * Creates a plain object from an ExportAnalyticsMetricsRequest message. Also converts values to other types if specified. + * @param message ExportAnalyticsMetricsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ExportAnalyticsMetricsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAnalyticsMetricsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportAnalyticsMetricsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportMetadata. */ + interface IExportMetadata { + + /** ExportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an ExportMetadata. */ + class ExportMetadata implements IExportMetadata { + + /** + * Constructs a new ExportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IExportMetadata); + + /** ExportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IExportMetadata): google.cloud.retail.v2.ExportMetadata; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ExportMetadata; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ExportMetadata; + + /** + * Verifies an ExportMetadata message. + * @param message Plain 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 ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ExportMetadata; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @param message ExportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportAnalyticsMetricsResponse. */ + interface IExportAnalyticsMetricsResponse { + + /** ExportAnalyticsMetricsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportAnalyticsMetricsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IExportErrorsConfig|null); + + /** ExportAnalyticsMetricsResponse outputResult */ + outputResult?: (google.cloud.retail.v2.IOutputResult|null); + } + + /** Represents an ExportAnalyticsMetricsResponse. */ + class ExportAnalyticsMetricsResponse implements IExportAnalyticsMetricsResponse { + + /** + * Constructs a new ExportAnalyticsMetricsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IExportAnalyticsMetricsResponse); + + /** ExportAnalyticsMetricsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportAnalyticsMetricsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IExportErrorsConfig|null); + + /** ExportAnalyticsMetricsResponse outputResult. */ + public outputResult?: (google.cloud.retail.v2.IOutputResult|null); + + /** + * Creates a new ExportAnalyticsMetricsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAnalyticsMetricsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IExportAnalyticsMetricsResponse): google.cloud.retail.v2.ExportAnalyticsMetricsResponse; + + /** + * Encodes the specified ExportAnalyticsMetricsResponse message. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsResponse.verify|verify} messages. + * @param message ExportAnalyticsMetricsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IExportAnalyticsMetricsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAnalyticsMetricsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsResponse.verify|verify} messages. + * @param message ExportAnalyticsMetricsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IExportAnalyticsMetricsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAnalyticsMetricsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAnalyticsMetricsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ExportAnalyticsMetricsResponse; + + /** + * Decodes an ExportAnalyticsMetricsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAnalyticsMetricsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ExportAnalyticsMetricsResponse; + + /** + * Verifies an ExportAnalyticsMetricsResponse message. + * @param message Plain 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 ExportAnalyticsMetricsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAnalyticsMetricsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ExportAnalyticsMetricsResponse; + + /** + * Creates a plain object from an ExportAnalyticsMetricsResponse message. Also converts values to other types if specified. + * @param message ExportAnalyticsMetricsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ExportAnalyticsMetricsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAnalyticsMetricsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportAnalyticsMetricsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OutputResult. */ + interface IOutputResult { + + /** OutputResult bigqueryResult */ + bigqueryResult?: (google.cloud.retail.v2.IBigQueryOutputResult[]|null); + + /** OutputResult gcsResult */ + gcsResult?: (google.cloud.retail.v2.IGcsOutputResult[]|null); + } + + /** Represents an OutputResult. */ + class OutputResult implements IOutputResult { + + /** + * Constructs a new OutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IOutputResult); + + /** OutputResult bigqueryResult. */ + public bigqueryResult: google.cloud.retail.v2.IBigQueryOutputResult[]; + + /** OutputResult gcsResult. */ + public gcsResult: google.cloud.retail.v2.IGcsOutputResult[]; + + /** + * Creates a new OutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputResult instance + */ + public static create(properties?: google.cloud.retail.v2.IOutputResult): google.cloud.retail.v2.OutputResult; + + /** + * Encodes the specified OutputResult message. Does not implicitly {@link google.cloud.retail.v2.OutputResult.verify|verify} messages. + * @param message OutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputResult.verify|verify} messages. + * @param message OutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.OutputResult; + + /** + * Decodes an OutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.OutputResult; + + /** + * Verifies an OutputResult message. + * @param message Plain 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 OutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.OutputResult; + + /** + * Creates a plain object from an OutputResult message. Also converts values to other types if specified. + * @param message OutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.OutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BigQueryOutputResult. */ + interface IBigQueryOutputResult { + + /** BigQueryOutputResult datasetId */ + datasetId?: (string|null); + + /** BigQueryOutputResult tableId */ + tableId?: (string|null); + } + + /** Represents a BigQueryOutputResult. */ + class BigQueryOutputResult implements IBigQueryOutputResult { + + /** + * Constructs a new BigQueryOutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IBigQueryOutputResult); + + /** BigQueryOutputResult datasetId. */ + public datasetId: string; + + /** BigQueryOutputResult tableId. */ + public tableId: string; + + /** + * Creates a new BigQueryOutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQueryOutputResult instance + */ + public static create(properties?: google.cloud.retail.v2.IBigQueryOutputResult): google.cloud.retail.v2.BigQueryOutputResult; + + /** + * Encodes the specified BigQueryOutputResult message. Does not implicitly {@link google.cloud.retail.v2.BigQueryOutputResult.verify|verify} messages. + * @param message BigQueryOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IBigQueryOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQueryOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQueryOutputResult.verify|verify} messages. + * @param message BigQueryOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IBigQueryOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.BigQueryOutputResult; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.BigQueryOutputResult; + + /** + * Verifies a BigQueryOutputResult message. + * @param message Plain 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 BigQueryOutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQueryOutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.BigQueryOutputResult; + + /** + * Creates a plain object from a BigQueryOutputResult message. Also converts values to other types if specified. + * @param message BigQueryOutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.BigQueryOutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQueryOutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQueryOutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GcsOutputResult. */ + interface IGcsOutputResult { + + /** GcsOutputResult outputUri */ + outputUri?: (string|null); + } + + /** Represents a GcsOutputResult. */ + class GcsOutputResult implements IGcsOutputResult { + + /** + * Constructs a new GcsOutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IGcsOutputResult); + + /** GcsOutputResult outputUri. */ + public outputUri: string; + + /** + * Creates a new GcsOutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsOutputResult instance + */ + public static create(properties?: google.cloud.retail.v2.IGcsOutputResult): google.cloud.retail.v2.GcsOutputResult; + + /** + * Encodes the specified GcsOutputResult message. Does not implicitly {@link google.cloud.retail.v2.GcsOutputResult.verify|verify} messages. + * @param message GcsOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IGcsOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsOutputResult.verify|verify} messages. + * @param message GcsOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IGcsOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsOutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsOutputResult; + + /** + * Decodes a GcsOutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsOutputResult; + + /** + * Verifies a GcsOutputResult message. + * @param message Plain 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 GcsOutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsOutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsOutputResult; + + /** + * Creates a plain object from a GcsOutputResult message. Also converts values to other types if specified. + * @param message GcsOutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.GcsOutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsOutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsOutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ProductLevelConfig. */ interface IProductLevelConfig { @@ -58462,270 +59546,6 @@ export namespace google { /** 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 - } - - /** 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 { @@ -60528,6 +61348,270 @@ export namespace google { DEPRECATED = 5 } + /** 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 + } + + /** 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 HttpBody. */ interface IHttpBody { @@ -64038,6 +65122,109 @@ export namespace google { } } + /** 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 a Timestamp. */ interface ITimestamp { @@ -64141,103 +65328,194 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a Duration. */ - interface IDuration { + /** Properties of an Any. */ + interface IAny { - /** Duration seconds */ - seconds?: (number|Long|string|null); + /** Any type_url */ + type_url?: (string|null); - /** Duration nanos */ - nanos?: (number|null); + /** Any value */ + value?: (Uint8Array|string|null); } - /** Represents a Duration. */ - class Duration implements IDuration { + /** Represents an Any. */ + class Any implements IAny { /** - * Constructs a new Duration. + * Constructs a new Any. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IDuration); + constructor(properties?: google.protobuf.IAny); - /** Duration seconds. */ - public seconds: (number|Long|string); + /** Any type_url. */ + public type_url: string; - /** Duration nanos. */ - public nanos: number; + /** Any value. */ + public value: (Uint8Array|string); /** - * Creates a new Duration instance using the specified properties. + * Creates a new Any instance using the specified properties. * @param [properties] Properties to set - * @returns Duration instance + * @returns Any instance */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode + * 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.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IAny, 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 + * 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.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Duration message from the specified reader or buffer. + * 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 Duration + * @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.Duration; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes an Any message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Duration + * @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.Duration; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; /** - * Verifies a Duration message. + * 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 a Duration message from a plain object. Also converts values to their respective internal types. + * Creates an Any message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Duration + * @returns Any */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @param message Duration + * 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.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Duration to JSON. + * Converts this Any to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Duration + * 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 */ @@ -65214,200 +66492,6 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an Any. */ - interface IAny { - - /** Any type_url */ - type_url?: (string|null); - - /** Any value */ - value?: (Uint8Array|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|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 Struct. */ interface IStruct { @@ -65851,119 +66935,6 @@ export namespace google { } } - /** Namespace type. */ - namespace type { - - /** Properties of a Date. */ - interface IDate { - - /** Date year */ - year?: (number|null); - - /** Date month */ - month?: (number|null); - - /** Date day */ - day?: (number|null); - } - - /** Represents a Date. */ - class Date implements IDate { - - /** - * Constructs a new Date. - * @param [properties] Properties to set - */ - constructor(properties?: google.type.IDate); - - /** Date year. */ - public year: number; - - /** Date month. */ - public month: number; - - /** Date day. */ - public day: number; - - /** - * Creates a new Date instance using the specified properties. - * @param [properties] Properties to set - * @returns Date instance - */ - public static create(properties?: google.type.IDate): google.type.Date; - - /** - * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. - * @param message Date message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. - * @param message Date message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Date message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Date - * @throws {Error} If the payload is not 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.Date; - - /** - * Decodes a Date message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Date - * @throws {Error} If the payload 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.Date; - - /** - * Verifies a Date message. - * @param message Plain 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 Date message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Date - */ - public static fromObject(object: { [k: string]: any }): google.type.Date; - - /** - * Creates a plain object from a Date message. Also converts values to other types if specified. - * @param message Date - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.type.Date, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Date to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Date - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - /** Namespace longrunning. */ namespace longrunning { @@ -66935,4 +67906,117 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } } + + /** Namespace type. */ + namespace type { + + /** Properties of a Date. */ + interface IDate { + + /** Date year */ + year?: (number|null); + + /** Date month */ + month?: (number|null); + + /** Date day */ + day?: (number|null); + } + + /** Represents a Date. */ + class Date implements IDate { + + /** + * Constructs a new Date. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IDate); + + /** Date year. */ + public year: number; + + /** Date month. */ + public month: number; + + /** Date day. */ + public day: number; + + /** + * Creates a new Date instance using the specified properties. + * @param [properties] Properties to set + * @returns Date instance + */ + public static create(properties?: google.type.IDate): google.type.Date; + + /** + * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @param message Date message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @param message Date message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Date message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Date + * @throws {Error} If the payload is not 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.Date; + + /** + * Decodes a Date message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Date + * @throws {Error} If the payload 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.Date; + + /** + * Verifies a Date message. + * @param message Plain 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 Date message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Date + */ + public static fromObject(object: { [k: string]: any }): google.type.Date; + + /** + * Creates a plain object from a Date message. Also converts values to other types if specified. + * @param message Date + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.Date, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Date to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Date + * @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-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 49f2dda600b..def311db11f 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -66,6 +66,2483 @@ */ var v2 = {}; + v2.AnalyticsService = (function() { + + /** + * Constructs a new AnalyticsService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AnalyticsService + * @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 AnalyticsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (AnalyticsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = AnalyticsService; + + /** + * Creates new AnalyticsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.AnalyticsService + * @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 {AnalyticsService} RPC service. Useful where requests and/or responses are streamed. + */ + AnalyticsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.AnalyticsService|exportAnalyticsMetrics}. + * @memberof google.cloud.retail.v2.AnalyticsService + * @typedef ExportAnalyticsMetricsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportAnalyticsMetrics. + * @function exportAnalyticsMetrics + * @memberof google.cloud.retail.v2.AnalyticsService + * @instance + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsRequest} request ExportAnalyticsMetricsRequest message or plain object + * @param {google.cloud.retail.v2.AnalyticsService.ExportAnalyticsMetricsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AnalyticsService.prototype.exportAnalyticsMetrics = function exportAnalyticsMetrics(request, callback) { + return this.rpcCall(exportAnalyticsMetrics, $root.google.cloud.retail.v2.ExportAnalyticsMetricsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportAnalyticsMetrics" }); + + /** + * Calls ExportAnalyticsMetrics. + * @function exportAnalyticsMetrics + * @memberof google.cloud.retail.v2.AnalyticsService + * @instance + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsRequest} request ExportAnalyticsMetricsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return AnalyticsService; + })(); + + v2.OutputConfig = (function() { + + /** + * Properties of an OutputConfig. + * @memberof google.cloud.retail.v2 + * @interface IOutputConfig + * @property {google.cloud.retail.v2.OutputConfig.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {google.cloud.retail.v2.OutputConfig.IBigQueryDestination|null} [bigqueryDestination] OutputConfig bigqueryDestination + */ + + /** + * Constructs a new OutputConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig + * @constructor + * @param {google.cloud.retail.v2.IOutputConfig=} [properties] Properties to set + */ + function OutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputConfig gcsDestination. + * @member {google.cloud.retail.v2.OutputConfig.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.retail.v2.OutputConfig + * @instance + */ + OutputConfig.prototype.gcsDestination = null; + + /** + * OutputConfig bigqueryDestination. + * @member {google.cloud.retail.v2.OutputConfig.IBigQueryDestination|null|undefined} bigqueryDestination + * @memberof google.cloud.retail.v2.OutputConfig + * @instance + */ + OutputConfig.prototype.bigqueryDestination = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * OutputConfig destination. + * @member {"gcsDestination"|"bigqueryDestination"|undefined} destination + * @memberof google.cloud.retail.v2.OutputConfig + * @instance + */ + Object.defineProperty(OutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination", "bigqueryDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new OutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {google.cloud.retail.v2.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.OutputConfig} OutputConfig instance + */ + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); + }; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {google.cloud.retail.v2.IOutputConfig} message OutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.retail.v2.OutputConfig.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.bigqueryDestination != null && Object.hasOwnProperty.call(message, "bigqueryDestination")) + $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination.encode(message.bigqueryDestination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {google.cloud.retail.v2.IOutputConfig} message OutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.OutputConfig} OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.OutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.retail.v2.OutputConfig.GcsDestination.decode(reader, reader.uint32()); + break; + } + case 2: { + message.bigqueryDestination = $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.OutputConfig} OutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.retail.v2.OutputConfig.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.bigqueryDestination != null && message.hasOwnProperty("bigqueryDestination")) { + if (properties.destination === 1) + return "destination: multiple values"; + properties.destination = 1; + { + var error = $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination.verify(message.bigqueryDestination); + if (error) + return "bigqueryDestination." + error; + } + } + return null; + }; + + /** + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.OutputConfig} OutputConfig + */ + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.OutputConfig) + return object; + var message = new $root.google.cloud.retail.v2.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.retail.v2.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.retail.v2.OutputConfig.GcsDestination.fromObject(object.gcsDestination); + } + if (object.bigqueryDestination != null) { + if (typeof object.bigqueryDestination !== "object") + throw TypeError(".google.cloud.retail.v2.OutputConfig.bigqueryDestination: object expected"); + message.bigqueryDestination = $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination.fromObject(object.bigqueryDestination); + } + return message; + }; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {google.cloud.retail.v2.OutputConfig} message OutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.retail.v2.OutputConfig.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.bigqueryDestination != null && message.hasOwnProperty("bigqueryDestination")) { + object.bigqueryDestination = $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination.toObject(message.bigqueryDestination, options); + if (options.oneofs) + object.destination = "bigqueryDestination"; + } + return object; + }; + + /** + * Converts this OutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.OutputConfig + * @instance + * @returns {Object.} JSON object + */ + OutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OutputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.OutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.OutputConfig"; + }; + + OutputConfig.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.retail.v2.OutputConfig + * @interface IGcsDestination + * @property {string|null} [outputUriPrefix] GcsDestination outputUriPrefix + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.retail.v2.OutputConfig + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.retail.v2.OutputConfig.IGcsDestination=} [properties] Properties to set + */ + function GcsDestination(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsDestination outputUriPrefix. + * @member {string} outputUriPrefix + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @instance + */ + GcsDestination.prototype.outputUriPrefix = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.retail.v2.OutputConfig.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.outputUriPrefix); + return writer; + }; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.OutputConfig.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.OutputConfig.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.outputUriPrefix = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.OutputConfig.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDestination message. + * @function verify + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDestination.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.outputUriPrefix != null && message.hasOwnProperty("outputUriPrefix")) + if (!$util.isString(message.outputUriPrefix)) + return "outputUriPrefix: string expected"; + return null; + }; + + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.OutputConfig.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.OutputConfig.GcsDestination) + return object; + var message = new $root.google.cloud.retail.v2.OutputConfig.GcsDestination(); + if (object.outputUriPrefix != null) + message.outputUriPrefix = String(object.outputUriPrefix); + return message; + }; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.GcsDestination} message GcsDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.outputUriPrefix = ""; + if (message.outputUriPrefix != null && message.hasOwnProperty("outputUriPrefix")) + object.outputUriPrefix = message.outputUriPrefix; + return object; + }; + + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @instance + * @returns {Object.} JSON object + */ + GcsDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GcsDestination + * @function getTypeUrl + * @memberof google.cloud.retail.v2.OutputConfig.GcsDestination + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.OutputConfig.GcsDestination"; + }; + + return GcsDestination; + })(); + + OutputConfig.BigQueryDestination = (function() { + + /** + * Properties of a BigQueryDestination. + * @memberof google.cloud.retail.v2.OutputConfig + * @interface IBigQueryDestination + * @property {string|null} [datasetId] BigQueryDestination datasetId + * @property {string|null} [tableIdPrefix] BigQueryDestination tableIdPrefix + * @property {string|null} [tableType] BigQueryDestination tableType + */ + + /** + * Constructs a new BigQueryDestination. + * @memberof google.cloud.retail.v2.OutputConfig + * @classdesc Represents a BigQueryDestination. + * @implements IBigQueryDestination + * @constructor + * @param {google.cloud.retail.v2.OutputConfig.IBigQueryDestination=} [properties] Properties to set + */ + function BigQueryDestination(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQueryDestination datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @instance + */ + BigQueryDestination.prototype.datasetId = ""; + + /** + * BigQueryDestination tableIdPrefix. + * @member {string} tableIdPrefix + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @instance + */ + BigQueryDestination.prototype.tableIdPrefix = ""; + + /** + * BigQueryDestination tableType. + * @member {string} tableType + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @instance + */ + BigQueryDestination.prototype.tableType = ""; + + /** + * Creates a new BigQueryDestination instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.IBigQueryDestination=} [properties] Properties to set + * @returns {google.cloud.retail.v2.OutputConfig.BigQueryDestination} BigQueryDestination instance + */ + BigQueryDestination.create = function create(properties) { + return new BigQueryDestination(properties); + }; + + /** + * Encodes the specified BigQueryDestination message. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.BigQueryDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.IBigQueryDestination} message BigQueryDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableIdPrefix != null && Object.hasOwnProperty.call(message, "tableIdPrefix")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableIdPrefix); + if (message.tableType != null && Object.hasOwnProperty.call(message, "tableType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.tableType); + return writer; + }; + + /** + * Encodes the specified BigQueryDestination message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputConfig.BigQueryDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.IBigQueryDestination} message BigQueryDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.OutputConfig.BigQueryDestination} BigQueryDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryDestination.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableIdPrefix = reader.string(); + break; + } + case 3: { + message.tableType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.OutputConfig.BigQueryDestination} BigQueryDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryDestination message. + * @function verify + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryDestination.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableIdPrefix != null && message.hasOwnProperty("tableIdPrefix")) + if (!$util.isString(message.tableIdPrefix)) + return "tableIdPrefix: string expected"; + if (message.tableType != null && message.hasOwnProperty("tableType")) + if (!$util.isString(message.tableType)) + return "tableType: string expected"; + return null; + }; + + /** + * Creates a BigQueryDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.OutputConfig.BigQueryDestination} BigQueryDestination + */ + BigQueryDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination) + return object; + var message = new $root.google.cloud.retail.v2.OutputConfig.BigQueryDestination(); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableIdPrefix != null) + message.tableIdPrefix = String(object.tableIdPrefix); + if (object.tableType != null) + message.tableType = String(object.tableType); + return message; + }; + + /** + * Creates a plain object from a BigQueryDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {google.cloud.retail.v2.OutputConfig.BigQueryDestination} message BigQueryDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableIdPrefix = ""; + object.tableType = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableIdPrefix != null && message.hasOwnProperty("tableIdPrefix")) + object.tableIdPrefix = message.tableIdPrefix; + if (message.tableType != null && message.hasOwnProperty("tableType")) + object.tableType = message.tableType; + return object; + }; + + /** + * Converts this BigQueryDestination to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @instance + * @returns {Object.} JSON object + */ + BigQueryDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BigQueryDestination + * @function getTypeUrl + * @memberof google.cloud.retail.v2.OutputConfig.BigQueryDestination + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQueryDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.OutputConfig.BigQueryDestination"; + }; + + return BigQueryDestination; + })(); + + return OutputConfig; + })(); + + v2.ExportErrorsConfig = (function() { + + /** + * Properties of an ExportErrorsConfig. + * @memberof google.cloud.retail.v2 + * @interface IExportErrorsConfig + * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ExportErrorsConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ExportErrorsConfig. + * @implements IExportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2.IExportErrorsConfig=} [properties] Properties to set + */ + function ExportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @instance + */ + ExportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @instance + */ + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ExportErrorsConfig} ExportErrorsConfig instance + */ + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); + }; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ExportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ExportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsPrefix = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ExportErrorsConfig} ExportErrorsConfig + */ + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ExportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2.ExportErrorsConfig} message ExportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ExportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportErrorsConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ExportErrorsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ExportErrorsConfig"; + }; + + return ExportErrorsConfig; + })(); + + v2.ExportAnalyticsMetricsRequest = (function() { + + /** + * Properties of an ExportAnalyticsMetricsRequest. + * @memberof google.cloud.retail.v2 + * @interface IExportAnalyticsMetricsRequest + * @property {string|null} [catalog] ExportAnalyticsMetricsRequest catalog + * @property {google.cloud.retail.v2.IOutputConfig|null} [outputConfig] ExportAnalyticsMetricsRequest outputConfig + * @property {string|null} [filter] ExportAnalyticsMetricsRequest filter + */ + + /** + * Constructs a new ExportAnalyticsMetricsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ExportAnalyticsMetricsRequest. + * @implements IExportAnalyticsMetricsRequest + * @constructor + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsRequest=} [properties] Properties to set + */ + function ExportAnalyticsMetricsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportAnalyticsMetricsRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @instance + */ + ExportAnalyticsMetricsRequest.prototype.catalog = ""; + + /** + * ExportAnalyticsMetricsRequest outputConfig. + * @member {google.cloud.retail.v2.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @instance + */ + ExportAnalyticsMetricsRequest.prototype.outputConfig = null; + + /** + * ExportAnalyticsMetricsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @instance + */ + ExportAnalyticsMetricsRequest.prototype.filter = ""; + + /** + * Creates a new ExportAnalyticsMetricsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsRequest} ExportAnalyticsMetricsRequest instance + */ + ExportAnalyticsMetricsRequest.create = function create(properties) { + return new ExportAnalyticsMetricsRequest(properties); + }; + + /** + * Encodes the specified ExportAnalyticsMetricsRequest message. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsRequest} message ExportAnalyticsMetricsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAnalyticsMetricsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.retail.v2.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ExportAnalyticsMetricsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsRequest} message ExportAnalyticsMetricsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAnalyticsMetricsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAnalyticsMetricsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsRequest} ExportAnalyticsMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAnalyticsMetricsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ExportAnalyticsMetricsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.outputConfig = $root.google.cloud.retail.v2.OutputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAnalyticsMetricsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsRequest} ExportAnalyticsMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAnalyticsMetricsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAnalyticsMetricsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAnalyticsMetricsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.retail.v2.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates an ExportAnalyticsMetricsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsRequest} ExportAnalyticsMetricsRequest + */ + ExportAnalyticsMetricsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ExportAnalyticsMetricsRequest) + return object; + var message = new $root.google.cloud.retail.v2.ExportAnalyticsMetricsRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ExportAnalyticsMetricsRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.retail.v2.OutputConfig.fromObject(object.outputConfig); + } + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from an ExportAnalyticsMetricsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {google.cloud.retail.v2.ExportAnalyticsMetricsRequest} message ExportAnalyticsMetricsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAnalyticsMetricsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = ""; + object.outputConfig = null; + object.filter = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.retail.v2.OutputConfig.toObject(message.outputConfig, options); + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ExportAnalyticsMetricsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @instance + * @returns {Object.} JSON object + */ + ExportAnalyticsMetricsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportAnalyticsMetricsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportAnalyticsMetricsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"; + }; + + return ExportAnalyticsMetricsRequest; + })(); + + v2.ExportMetadata = (function() { + + /** + * Properties of an ExportMetadata. + * @memberof google.cloud.retail.v2 + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + */ + + /** + * Constructs a new ExportMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata + * @constructor + * @param {google.cloud.retail.v2.IExportMetadata=} [properties] Properties to set + */ + function ExportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2.ExportMetadata + * @instance + */ + ExportMetadata.prototype.createTime = null; + + /** + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2.ExportMetadata + * @instance + */ + ExportMetadata.prototype.updateTime = null; + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {google.cloud.retail.v2.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ExportMetadata} ExportMetadata instance + */ + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); + }; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ExportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {google.cloud.retail.v2.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {google.cloud.retail.v2.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ExportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ExportMetadata} ExportMetadata + */ + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ExportMetadata) + return object; + var message = new $root.google.cloud.retail.v2.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {google.cloud.retail.v2.ExportMetadata} message ExportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this ExportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ExportMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ExportMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ExportMetadata"; + }; + + return ExportMetadata; + })(); + + v2.ExportAnalyticsMetricsResponse = (function() { + + /** + * Properties of an ExportAnalyticsMetricsResponse. + * @memberof google.cloud.retail.v2 + * @interface IExportAnalyticsMetricsResponse + * @property {Array.|null} [errorSamples] ExportAnalyticsMetricsResponse errorSamples + * @property {google.cloud.retail.v2.IExportErrorsConfig|null} [errorsConfig] ExportAnalyticsMetricsResponse errorsConfig + * @property {google.cloud.retail.v2.IOutputResult|null} [outputResult] ExportAnalyticsMetricsResponse outputResult + */ + + /** + * Constructs a new ExportAnalyticsMetricsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ExportAnalyticsMetricsResponse. + * @implements IExportAnalyticsMetricsResponse + * @constructor + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsResponse=} [properties] Properties to set + */ + function ExportAnalyticsMetricsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportAnalyticsMetricsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @instance + */ + ExportAnalyticsMetricsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportAnalyticsMetricsResponse errorsConfig. + * @member {google.cloud.retail.v2.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @instance + */ + ExportAnalyticsMetricsResponse.prototype.errorsConfig = null; + + /** + * ExportAnalyticsMetricsResponse outputResult. + * @member {google.cloud.retail.v2.IOutputResult|null|undefined} outputResult + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @instance + */ + ExportAnalyticsMetricsResponse.prototype.outputResult = null; + + /** + * Creates a new ExportAnalyticsMetricsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsResponse} ExportAnalyticsMetricsResponse instance + */ + ExportAnalyticsMetricsResponse.create = function create(properties) { + return new ExportAnalyticsMetricsResponse(properties); + }; + + /** + * Encodes the specified ExportAnalyticsMetricsResponse message. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsResponse} message ExportAnalyticsMetricsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAnalyticsMetricsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputResult != null && Object.hasOwnProperty.call(message, "outputResult")) + $root.google.cloud.retail.v2.OutputResult.encode(message.outputResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportAnalyticsMetricsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ExportAnalyticsMetricsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {google.cloud.retail.v2.IExportAnalyticsMetricsResponse} message ExportAnalyticsMetricsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAnalyticsMetricsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAnalyticsMetricsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsResponse} ExportAnalyticsMetricsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAnalyticsMetricsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ExportAnalyticsMetricsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputResult = $root.google.cloud.retail.v2.OutputResult.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAnalyticsMetricsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsResponse} ExportAnalyticsMetricsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAnalyticsMetricsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAnalyticsMetricsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAnalyticsMetricsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.outputResult != null && message.hasOwnProperty("outputResult")) { + var error = $root.google.cloud.retail.v2.OutputResult.verify(message.outputResult); + if (error) + return "outputResult." + error; + } + return null; + }; + + /** + * Creates an ExportAnalyticsMetricsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ExportAnalyticsMetricsResponse} ExportAnalyticsMetricsResponse + */ + ExportAnalyticsMetricsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ExportAnalyticsMetricsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ExportAnalyticsMetricsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ExportAnalyticsMetricsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ExportAnalyticsMetricsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ExportAnalyticsMetricsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ExportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.outputResult != null) { + if (typeof object.outputResult !== "object") + throw TypeError(".google.cloud.retail.v2.ExportAnalyticsMetricsResponse.outputResult: object expected"); + message.outputResult = $root.google.cloud.retail.v2.OutputResult.fromObject(object.outputResult); + } + return message; + }; + + /** + * Creates a plain object from an ExportAnalyticsMetricsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {google.cloud.retail.v2.ExportAnalyticsMetricsResponse} message ExportAnalyticsMetricsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAnalyticsMetricsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.outputResult = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.outputResult != null && message.hasOwnProperty("outputResult")) + object.outputResult = $root.google.cloud.retail.v2.OutputResult.toObject(message.outputResult, options); + return object; + }; + + /** + * Converts this ExportAnalyticsMetricsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportAnalyticsMetricsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportAnalyticsMetricsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ExportAnalyticsMetricsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportAnalyticsMetricsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"; + }; + + return ExportAnalyticsMetricsResponse; + })(); + + v2.OutputResult = (function() { + + /** + * Properties of an OutputResult. + * @memberof google.cloud.retail.v2 + * @interface IOutputResult + * @property {Array.|null} [bigqueryResult] OutputResult bigqueryResult + * @property {Array.|null} [gcsResult] OutputResult gcsResult + */ + + /** + * Constructs a new OutputResult. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an OutputResult. + * @implements IOutputResult + * @constructor + * @param {google.cloud.retail.v2.IOutputResult=} [properties] Properties to set + */ + function OutputResult(properties) { + this.bigqueryResult = []; + this.gcsResult = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputResult bigqueryResult. + * @member {Array.} bigqueryResult + * @memberof google.cloud.retail.v2.OutputResult + * @instance + */ + OutputResult.prototype.bigqueryResult = $util.emptyArray; + + /** + * OutputResult gcsResult. + * @member {Array.} gcsResult + * @memberof google.cloud.retail.v2.OutputResult + * @instance + */ + OutputResult.prototype.gcsResult = $util.emptyArray; + + /** + * Creates a new OutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {google.cloud.retail.v2.IOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.OutputResult} OutputResult instance + */ + OutputResult.create = function create(properties) { + return new OutputResult(properties); + }; + + /** + * Encodes the specified OutputResult message. Does not implicitly {@link google.cloud.retail.v2.OutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {google.cloud.retail.v2.IOutputResult} message OutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigqueryResult != null && message.bigqueryResult.length) + for (var i = 0; i < message.bigqueryResult.length; ++i) + $root.google.cloud.retail.v2.BigQueryOutputResult.encode(message.bigqueryResult[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsResult != null && message.gcsResult.length) + for (var i = 0; i < message.gcsResult.length; ++i) + $root.google.cloud.retail.v2.GcsOutputResult.encode(message.gcsResult[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.OutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {google.cloud.retail.v2.IOutputResult} message OutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.OutputResult} OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.OutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.bigqueryResult && message.bigqueryResult.length)) + message.bigqueryResult = []; + message.bigqueryResult.push($root.google.cloud.retail.v2.BigQueryOutputResult.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.gcsResult && message.gcsResult.length)) + message.gcsResult = []; + message.gcsResult.push($root.google.cloud.retail.v2.GcsOutputResult.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.OutputResult} OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputResult message. + * @function verify + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bigqueryResult != null && message.hasOwnProperty("bigqueryResult")) { + if (!Array.isArray(message.bigqueryResult)) + return "bigqueryResult: array expected"; + for (var i = 0; i < message.bigqueryResult.length; ++i) { + var error = $root.google.cloud.retail.v2.BigQueryOutputResult.verify(message.bigqueryResult[i]); + if (error) + return "bigqueryResult." + error; + } + } + if (message.gcsResult != null && message.hasOwnProperty("gcsResult")) { + if (!Array.isArray(message.gcsResult)) + return "gcsResult: array expected"; + for (var i = 0; i < message.gcsResult.length; ++i) { + var error = $root.google.cloud.retail.v2.GcsOutputResult.verify(message.gcsResult[i]); + if (error) + return "gcsResult." + error; + } + } + return null; + }; + + /** + * Creates an OutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.OutputResult} OutputResult + */ + OutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.OutputResult) + return object; + var message = new $root.google.cloud.retail.v2.OutputResult(); + if (object.bigqueryResult) { + if (!Array.isArray(object.bigqueryResult)) + throw TypeError(".google.cloud.retail.v2.OutputResult.bigqueryResult: array expected"); + message.bigqueryResult = []; + for (var i = 0; i < object.bigqueryResult.length; ++i) { + if (typeof object.bigqueryResult[i] !== "object") + throw TypeError(".google.cloud.retail.v2.OutputResult.bigqueryResult: object expected"); + message.bigqueryResult[i] = $root.google.cloud.retail.v2.BigQueryOutputResult.fromObject(object.bigqueryResult[i]); + } + } + if (object.gcsResult) { + if (!Array.isArray(object.gcsResult)) + throw TypeError(".google.cloud.retail.v2.OutputResult.gcsResult: array expected"); + message.gcsResult = []; + for (var i = 0; i < object.gcsResult.length; ++i) { + if (typeof object.gcsResult[i] !== "object") + throw TypeError(".google.cloud.retail.v2.OutputResult.gcsResult: object expected"); + message.gcsResult[i] = $root.google.cloud.retail.v2.GcsOutputResult.fromObject(object.gcsResult[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {google.cloud.retail.v2.OutputResult} message OutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.bigqueryResult = []; + object.gcsResult = []; + } + if (message.bigqueryResult && message.bigqueryResult.length) { + object.bigqueryResult = []; + for (var j = 0; j < message.bigqueryResult.length; ++j) + object.bigqueryResult[j] = $root.google.cloud.retail.v2.BigQueryOutputResult.toObject(message.bigqueryResult[j], options); + } + if (message.gcsResult && message.gcsResult.length) { + object.gcsResult = []; + for (var j = 0; j < message.gcsResult.length; ++j) + object.gcsResult[j] = $root.google.cloud.retail.v2.GcsOutputResult.toObject(message.gcsResult[j], options); + } + return object; + }; + + /** + * Converts this OutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.OutputResult + * @instance + * @returns {Object.} JSON object + */ + OutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.OutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.OutputResult"; + }; + + return OutputResult; + })(); + + v2.BigQueryOutputResult = (function() { + + /** + * Properties of a BigQueryOutputResult. + * @memberof google.cloud.retail.v2 + * @interface IBigQueryOutputResult + * @property {string|null} [datasetId] BigQueryOutputResult datasetId + * @property {string|null} [tableId] BigQueryOutputResult tableId + */ + + /** + * Constructs a new BigQueryOutputResult. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a BigQueryOutputResult. + * @implements IBigQueryOutputResult + * @constructor + * @param {google.cloud.retail.v2.IBigQueryOutputResult=} [properties] Properties to set + */ + function BigQueryOutputResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQueryOutputResult datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @instance + */ + BigQueryOutputResult.prototype.datasetId = ""; + + /** + * BigQueryOutputResult tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @instance + */ + BigQueryOutputResult.prototype.tableId = ""; + + /** + * Creates a new BigQueryOutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2.IBigQueryOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.BigQueryOutputResult} BigQueryOutputResult instance + */ + BigQueryOutputResult.create = function create(properties) { + return new BigQueryOutputResult(properties); + }; + + /** + * Encodes the specified BigQueryOutputResult message. Does not implicitly {@link google.cloud.retail.v2.BigQueryOutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2.IBigQueryOutputResult} message BigQueryOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + return writer; + }; + + /** + * Encodes the specified BigQueryOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQueryOutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2.IBigQueryOutputResult} message BigQueryOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.BigQueryOutputResult} BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.BigQueryOutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.BigQueryOutputResult} BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryOutputResult message. + * @function verify + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryOutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + return null; + }; + + /** + * Creates a BigQueryOutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.BigQueryOutputResult} BigQueryOutputResult + */ + BigQueryOutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.BigQueryOutputResult) + return object; + var message = new $root.google.cloud.retail.v2.BigQueryOutputResult(); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + return message; + }; + + /** + * Creates a plain object from a BigQueryOutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2.BigQueryOutputResult} message BigQueryOutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryOutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + return object; + }; + + /** + * Converts this BigQueryOutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @instance + * @returns {Object.} JSON object + */ + BigQueryOutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BigQueryOutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.BigQueryOutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQueryOutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.BigQueryOutputResult"; + }; + + return BigQueryOutputResult; + })(); + + v2.GcsOutputResult = (function() { + + /** + * Properties of a GcsOutputResult. + * @memberof google.cloud.retail.v2 + * @interface IGcsOutputResult + * @property {string|null} [outputUri] GcsOutputResult outputUri + */ + + /** + * Constructs a new GcsOutputResult. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a GcsOutputResult. + * @implements IGcsOutputResult + * @constructor + * @param {google.cloud.retail.v2.IGcsOutputResult=} [properties] Properties to set + */ + function GcsOutputResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsOutputResult outputUri. + * @member {string} outputUri + * @memberof google.cloud.retail.v2.GcsOutputResult + * @instance + */ + GcsOutputResult.prototype.outputUri = ""; + + /** + * Creates a new GcsOutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {google.cloud.retail.v2.IGcsOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GcsOutputResult} GcsOutputResult instance + */ + GcsOutputResult.create = function create(properties) { + return new GcsOutputResult(properties); + }; + + /** + * Encodes the specified GcsOutputResult message. Does not implicitly {@link google.cloud.retail.v2.GcsOutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {google.cloud.retail.v2.IGcsOutputResult} message GcsOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsOutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.outputUri != null && Object.hasOwnProperty.call(message, "outputUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.outputUri); + return writer; + }; + + /** + * Encodes the specified GcsOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsOutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {google.cloud.retail.v2.IGcsOutputResult} message GcsOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsOutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsOutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.GcsOutputResult} GcsOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsOutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GcsOutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.outputUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsOutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.GcsOutputResult} GcsOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsOutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsOutputResult message. + * @function verify + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsOutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.outputUri != null && message.hasOwnProperty("outputUri")) + if (!$util.isString(message.outputUri)) + return "outputUri: string expected"; + return null; + }; + + /** + * Creates a GcsOutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.GcsOutputResult} GcsOutputResult + */ + GcsOutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GcsOutputResult) + return object; + var message = new $root.google.cloud.retail.v2.GcsOutputResult(); + if (object.outputUri != null) + message.outputUri = String(object.outputUri); + return message; + }; + + /** + * Creates a plain object from a GcsOutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {google.cloud.retail.v2.GcsOutputResult} message GcsOutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsOutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.outputUri = ""; + if (message.outputUri != null && message.hasOwnProperty("outputUri")) + object.outputUri = message.outputUri; + return object; + }; + + /** + * Converts this GcsOutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.GcsOutputResult + * @instance + * @returns {Object.} JSON object + */ + GcsOutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GcsOutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GcsOutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsOutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GcsOutputResult"; + }; + + return GcsOutputResult; + })(); + v2.ProductLevelConfig = (function() { /** @@ -143382,716 +145859,6 @@ */ 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 - */ - 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; - 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) - 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) { - if (!writer) - writer = $Writer.create(); - 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).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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); - while (reader.pos < end) { - var tag = reader.uint32(); - 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); - 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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("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 && message.hasOwnProperty("nameField")) - if (!$util.isString(message.nameField)) - return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) - switch (message.history) { - default: - return "history: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.plural != null && message.hasOwnProperty("plural")) - if (!$util.isString(message.plural)) - return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) - if (!$util.isString(message.singular)) - return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("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) { - if (object instanceof $root.google.api.ResourceDescriptor) - return object; - 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) { - if (!options) - options = {}; - 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 && message.hasOwnProperty("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 && message.hasOwnProperty("nameField")) - object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("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 && message.hasOwnProperty("plural")) - object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("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) - 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) { - if (!writer) - writer = $Writer.create(); - 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).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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.string(); - break; - } - case 2: { - message.childType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - 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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("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) { - if (object instanceof $root.google.api.ResourceReference) - return object; - 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) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = ""; - object.childType = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.childType != null && message.hasOwnProperty("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() { /** @@ -148664,6 +150431,716 @@ return values; })(); + /** + * 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 + */ + 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; + 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) + 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) { + if (!writer) + writer = $Writer.create(); + 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).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) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + 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); + 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) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("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 && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("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) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + 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) { + if (!options) + options = {}; + 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 && message.hasOwnProperty("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 && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("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 && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("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) + 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) { + if (!writer) + writer = $Writer.create(); + 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).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) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + 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) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("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) { + if (object instanceof $root.google.api.ResourceReference) + return object; + 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) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("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.HttpBody = (function() { /** @@ -158601,6 +161078,247 @@ return GeneratedCodeInfo; })(); + 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) + 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) { + if (!writer) + writer = $Writer.create(); + 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).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) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + 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) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("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 && message.hasOwnProperty("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) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = 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) { + if (!options) + options = {}; + 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() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + 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 && message.hasOwnProperty("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.Timestamp = (function() { /** @@ -158842,25 +161560,25 @@ return Timestamp; })(); - protobuf.Duration = (function() { + protobuf.Any = (function() { /** - * Properties of a Duration. + * Properties of an Any. * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value */ /** - * Constructs a new Duration. + * Constructs a new Any. * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration + * @classdesc Represents an Any. + * @implements IAny * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set + * @param {google.protobuf.IAny=} [properties] Properties to set */ - function Duration(properties) { + function Any(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -158868,89 +161586,89 @@ } /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any * @instance */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Any.prototype.type_url = ""; /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any * @instance */ - Duration.prototype.nanos = 0; + Any.prototype.value = $util.newBuffer([]); /** - * Creates a new Duration instance using the specified properties. + * Creates a new Any instance using the specified properties. * @function create - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance */ - Duration.create = function create(properties) { - return new Duration(properties); + Any.create = function create(properties) { + return new Any(properties); }; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. * @function encode - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.protobuf.IAny} message Any message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encode = function encode(message, writer) { + Any.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - 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); + 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 Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.protobuf.IAny} message Any message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { + Any.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes an Any message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Duration + * @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.Duration} Duration + * @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 */ - Duration.decode = function decode(reader, length) { + Any.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.seconds = reader.int64(); + message.type_url = reader.string(); break; } case 2: { - message.nanos = reader.int32(); + message.value = reader.bytes(); break; } default: @@ -158962,125 +161680,295 @@ }; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes an Any message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration + * @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 */ - Duration.decodeDelimited = function decodeDelimited(reader) { + Any.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Duration message. + * Verifies an Any message. * @function verify - * @memberof google.protobuf.Duration + * @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 */ - Duration.verify = function verify(message) { + Any.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.seconds != null && message.hasOwnProperty("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 && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; return null; }; /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates an Any message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.Any} Any */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) return object; - var message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = 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; + 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 a Duration message. Also converts values to other types if specified. + * Creates a plain object from an Any message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static - * @param {google.protobuf.Duration} message Duration + * @param {google.protobuf.Any} message Any * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + Any.toObject = function toObject(message, options) { if (!options) options = {}; 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() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } } - if (message.seconds != null && message.hasOwnProperty("seconds")) - 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 && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("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 Duration to JSON. + * Converts this Any to JSON. * @function toJSON - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @instance * @returns {Object.} JSON object */ - Duration.prototype.toJSON = function toJSON() { + Any.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Duration + * Gets the default type url for Any * @function getTypeUrl - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Any * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.Duration"; + return typeUrlPrefix + "/google.protobuf.Any"; }; - return Duration; + 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) + 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) { + if (!writer) + writer = $Writer.create(); + 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).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) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + 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) { + if (typeof message !== "object" || message === null) + return "object expected"; + 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) { + 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() { @@ -161166,417 +164054,6 @@ return BytesValue; })(); - 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) - 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) { - if (!writer) - writer = $Writer.create(); - 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).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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type_url = reader.string(); - break; - } - case 2: { - message.value = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - 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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type_url != null && message.hasOwnProperty("type_url")) - if (!$util.isString(message.type_url)) - return "type_url: string expected"; - if (message.value != null && message.hasOwnProperty("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) { - if (object instanceof $root.google.protobuf.Any) - return object; - 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) { - if (!options) - options = {}; - 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 && message.hasOwnProperty("type_url")) - object.type_url = message.type_url; - if (message.value != null && message.hasOwnProperty("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) - 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) { - if (!writer) - writer = $Writer.create(); - 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).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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - 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) { - if (typeof message !== "object" || message === null) - return "object expected"; - 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) { - 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.Struct = (function() { /** @@ -162737,268 +165214,6 @@ return rpc; })(); - google.type = (function() { - - /** - * Namespace type. - * @memberof google - * @namespace - */ - var type = {}; - - type.Date = (function() { - - /** - * Properties of a Date. - * @memberof google.type - * @interface IDate - * @property {number|null} [year] Date year - * @property {number|null} [month] Date month - * @property {number|null} [day] Date day - */ - - /** - * Constructs a new Date. - * @memberof google.type - * @classdesc Represents a Date. - * @implements IDate - * @constructor - * @param {google.type.IDate=} [properties] Properties to set - */ - function Date(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Date year. - * @member {number} year - * @memberof google.type.Date - * @instance - */ - Date.prototype.year = 0; - - /** - * Date month. - * @member {number} month - * @memberof google.type.Date - * @instance - */ - Date.prototype.month = 0; - - /** - * Date day. - * @member {number} day - * @memberof google.type.Date - * @instance - */ - Date.prototype.day = 0; - - /** - * Creates a new Date instance using the specified properties. - * @function create - * @memberof google.type.Date - * @static - * @param {google.type.IDate=} [properties] Properties to set - * @returns {google.type.Date} Date instance - */ - Date.create = function create(properties) { - return new Date(properties); - }; - - /** - * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. - * @function encode - * @memberof google.type.Date - * @static - * @param {google.type.IDate} message Date message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Date.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.year != null && Object.hasOwnProperty.call(message, "year")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.year); - if (message.month != null && Object.hasOwnProperty.call(message, "month")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.month); - if (message.day != null && Object.hasOwnProperty.call(message, "day")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.day); - return writer; - }; - - /** - * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. - * @function encodeDelimited - * @memberof google.type.Date - * @static - * @param {google.type.IDate} message Date message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Date.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Date message from the specified reader or buffer. - * @function decode - * @memberof google.type.Date - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.type.Date} Date - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Date.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Date(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.year = reader.int32(); - break; - } - case 2: { - message.month = reader.int32(); - break; - } - case 3: { - message.day = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Date message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.type.Date - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.type.Date} Date - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Date.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Date message. - * @function verify - * @memberof google.type.Date - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Date.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.year != null && message.hasOwnProperty("year")) - if (!$util.isInteger(message.year)) - return "year: integer expected"; - if (message.month != null && message.hasOwnProperty("month")) - if (!$util.isInteger(message.month)) - return "month: integer expected"; - if (message.day != null && message.hasOwnProperty("day")) - if (!$util.isInteger(message.day)) - return "day: integer expected"; - return null; - }; - - /** - * Creates a Date message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.type.Date - * @static - * @param {Object.} object Plain object - * @returns {google.type.Date} Date - */ - Date.fromObject = function fromObject(object) { - if (object instanceof $root.google.type.Date) - return object; - var message = new $root.google.type.Date(); - if (object.year != null) - message.year = object.year | 0; - if (object.month != null) - message.month = object.month | 0; - if (object.day != null) - message.day = object.day | 0; - return message; - }; - - /** - * Creates a plain object from a Date message. Also converts values to other types if specified. - * @function toObject - * @memberof google.type.Date - * @static - * @param {google.type.Date} message Date - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Date.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.year = 0; - object.month = 0; - object.day = 0; - } - if (message.year != null && message.hasOwnProperty("year")) - object.year = message.year; - if (message.month != null && message.hasOwnProperty("month")) - object.month = message.month; - if (message.day != null && message.hasOwnProperty("day")) - object.day = message.day; - return object; - }; - - /** - * Converts this Date to JSON. - * @function toJSON - * @memberof google.type.Date - * @instance - * @returns {Object.} JSON object - */ - Date.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Date - * @function getTypeUrl - * @memberof google.type.Date - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Date.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.type.Date"; - }; - - return Date; - })(); - - return type; - })(); - google.longrunning = (function() { /** @@ -165138,6 +167353,268 @@ return longrunning; })(); + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Date = (function() { + + /** + * Properties of a Date. + * @memberof google.type + * @interface IDate + * @property {number|null} [year] Date year + * @property {number|null} [month] Date month + * @property {number|null} [day] Date day + */ + + /** + * Constructs a new Date. + * @memberof google.type + * @classdesc Represents a Date. + * @implements IDate + * @constructor + * @param {google.type.IDate=} [properties] Properties to set + */ + function Date(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Date year. + * @member {number} year + * @memberof google.type.Date + * @instance + */ + Date.prototype.year = 0; + + /** + * Date month. + * @member {number} month + * @memberof google.type.Date + * @instance + */ + Date.prototype.month = 0; + + /** + * Date day. + * @member {number} day + * @memberof google.type.Date + * @instance + */ + Date.prototype.day = 0; + + /** + * Creates a new Date instance using the specified properties. + * @function create + * @memberof google.type.Date + * @static + * @param {google.type.IDate=} [properties] Properties to set + * @returns {google.type.Date} Date instance + */ + Date.create = function create(properties) { + return new Date(properties); + }; + + /** + * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @function encode + * @memberof google.type.Date + * @static + * @param {google.type.IDate} message Date message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Date.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.year != null && Object.hasOwnProperty.call(message, "year")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.year); + if (message.month != null && Object.hasOwnProperty.call(message, "month")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.month); + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.day); + return writer; + }; + + /** + * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Date + * @static + * @param {google.type.IDate} message Date message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Date.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Date message from the specified reader or buffer. + * @function decode + * @memberof google.type.Date + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.Date} Date + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Date.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Date(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.year = reader.int32(); + break; + } + case 2: { + message.month = reader.int32(); + break; + } + case 3: { + message.day = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Date message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Date + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.Date} Date + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Date.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Date message. + * @function verify + * @memberof google.type.Date + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Date.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.year != null && message.hasOwnProperty("year")) + if (!$util.isInteger(message.year)) + return "year: integer expected"; + if (message.month != null && message.hasOwnProperty("month")) + if (!$util.isInteger(message.month)) + return "month: integer expected"; + if (message.day != null && message.hasOwnProperty("day")) + if (!$util.isInteger(message.day)) + return "day: integer expected"; + return null; + }; + + /** + * Creates a Date message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Date + * @static + * @param {Object.} object Plain object + * @returns {google.type.Date} Date + */ + Date.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Date) + return object; + var message = new $root.google.type.Date(); + if (object.year != null) + message.year = object.year | 0; + if (object.month != null) + message.month = object.month | 0; + if (object.day != null) + message.day = object.day | 0; + return message; + }; + + /** + * Creates a plain object from a Date message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Date + * @static + * @param {google.type.Date} message Date + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Date.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.year = 0; + object.month = 0; + object.day = 0; + } + if (message.year != null && message.hasOwnProperty("year")) + object.year = message.year; + if (message.month != null && message.hasOwnProperty("month")) + object.month = message.month; + if (message.day != null && message.hasOwnProperty("day")) + object.day = message.day; + return object; + }; + + /** + * Converts this Date to JSON. + * @function toJSON + * @memberof google.type.Date + * @instance + * @returns {Object.} JSON object + */ + Date.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Date + * @function getTypeUrl + * @memberof google.type.Date + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Date.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Date"; + }; + + return Date; + })(); + + return type; + })(); + return google; })(); diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index c805cbdd73b..4d40565e974 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -20,6 +20,196 @@ "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}" }, "nested": { + "AnalyticsService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ExportAnalyticsMetrics": { + "requestType": "ExportAnalyticsMetricsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ExportAnalyticsMetricsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ExportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ExportAnalyticsMetricsResponse", + "metadata_type": "google.cloud.retail.v2.ExportMetadata" + } + } + ] + } + } + }, + "OutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination", + "bigqueryDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + }, + "bigqueryDestination": { + "type": "BigQueryDestination", + "id": 2 + } + }, + "nested": { + "GcsDestination": { + "fields": { + "outputUriPrefix": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BigQueryDestination": { + "fields": { + "datasetId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tableIdPrefix": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tableType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "ExportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ExportAnalyticsMetricsRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "OutputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "filter": { + "type": "string", + "id": 3 + } + } + }, + "ExportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "ExportAnalyticsMetricsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + }, + "outputResult": { + "type": "OutputResult", + "id": 3 + } + } + }, + "OutputResult": { + "fields": { + "bigqueryResult": { + "rule": "repeated", + "type": "BigQueryOutputResult", + "id": 1 + }, + "gcsResult": { + "rule": "repeated", + "type": "GcsOutputResult", + "id": 2 + } + } + }, + "BigQueryOutputResult": { + "fields": { + "datasetId": { + "type": "string", + "id": 1 + }, + "tableId": { + "type": "string", + "id": 2 + } + } + }, + "GcsOutputResult": { + "fields": { + "outputUri": { + "type": "string", + "id": 1 + } + } + }, "ProductLevelConfig": { "fields": { "ingestionProductType": { @@ -14991,101 +15181,6 @@ "cc_enable_arenas": true }, "nested": { - "fieldBehavior": { - "rule": "repeated", - "type": "google.api.FieldBehavior", - "id": 1052, - "extend": "google.protobuf.FieldOptions" - }, - "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 - } - }, - "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, @@ -15431,6 +15526,101 @@ "DEPRECATED": 5 } }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "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 + } + }, + "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 + } + } + }, "HttpBody": { "fields": { "contentType": { @@ -16431,7 +16621,7 @@ } } }, - "Timestamp": { + "Duration": { "fields": { "seconds": { "type": "int64", @@ -16443,7 +16633,7 @@ } } }, - "Duration": { + "Timestamp": { "fields": { "seconds": { "type": "int64", @@ -16455,6 +16645,21 @@ } } }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, "FieldMask": { "fields": { "paths": { @@ -16536,21 +16741,6 @@ } } }, - "Any": { - "fields": { - "type_url": { - "type": "string", - "id": 1 - }, - "value": { - "type": "bytes", - "id": 2 - } - } - }, - "Empty": { - "fields": {} - }, "Struct": { "fields": { "fields": { @@ -16645,34 +16835,6 @@ } } }, - "type": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/type/date;date", - "java_multiple_files": true, - "java_outer_classname": "DateProto", - "java_package": "com.google.type", - "objc_class_prefix": "GTP" - }, - "nested": { - "Date": { - "fields": { - "year": { - "type": "int32", - "id": 1 - }, - "month": { - "type": "int32", - "id": 2 - }, - "day": { - "type": "int32", - "id": 3 - } - } - } - } - }, "longrunning": { "options": { "cc_enable_arenas": true, @@ -16888,6 +17050,34 @@ } } } + }, + "type": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/type/date;date", + "java_multiple_files": true, + "java_outer_classname": "DateProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "Date": { + "fields": { + "year": { + "type": "int32", + "id": 1 + }, + "month": { + "type": "int32", + "id": 2 + }, + "day": { + "type": "int32", + "id": 3 + } + } + } + } } } } diff --git a/packages/google-cloud-retail/samples/README.md b/packages/google-cloud-retail/samples/README.md index b80557e9a75..5839485e8d8 100644 --- a/packages/google-cloud-retail/samples/README.md +++ b/packages/google-cloud-retail/samples/README.md @@ -12,6 +12,7 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Analytics_service.export_analytics_metrics](#analytics_service.export_analytics_metrics) * [Catalog_service.add_catalog_attribute](#catalog_service.add_catalog_attribute) * [Catalog_service.get_attributes_config](#catalog_service.get_attributes_config) * [Catalog_service.get_completion_config](#catalog_service.get_completion_config) @@ -190,6 +191,23 @@ Before running the samples, make sure you've followed the steps outlined in +### Analytics_service.export_analytics_metrics + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js` + + +----- + + + + ### Catalog_service.add_catalog_attribute View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js). diff --git a/packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js b/packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js new file mode 100644 index 00000000000..f4cd8f061cd --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/analytics_service.export_analytics_metrics.js @@ -0,0 +1,84 @@ +// Copyright 2024 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(catalog, outputConfig) { + // [START retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_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. Full resource name of the parent catalog. + * Expected format: `projects/* /locations/* /catalogs/*` + */ + // const catalog = 'abc123' + /** + * Required. The output location of the data. + */ + // const outputConfig = {} + /** + * A filtering expression to specify restrictions on returned metrics. + * The expression is a sequence of terms. Each term applies a restriction to + * the returned metrics. Use this expression to restrict results to a + * specific time range. + * Currently we expect only one types of fields: + * * `timestamp`: This can be specified twice, once with a + * less than operator and once with a greater than operator. The + * `timestamp` restriction should result in one, contiguous, valid, + * `timestamp` range. + * Some examples of valid filters expressions: + * * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" + * timestamp < "2012-04-23T18:30:43.511Z"` + * * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` + */ + // const filter = 'abc123' + + // Imports the Retail library + const {AnalyticsServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new AnalyticsServiceClient(); + + async function callExportAnalyticsMetrics() { + // Construct request + const request = { + catalog, + outputConfig, + }; + + // Run request + const [operation] = await retailClient.exportAnalyticsMetrics(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportAnalyticsMetrics(); + // [END retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata_google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata_google.cloud.retail.v2.json index bb5b1cfd1a7..b6e8bf35929 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata_google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata_google.cloud.retail.v2.json @@ -11,9 +11,57 @@ ] }, "snippets": [ + { + "regionTag": "retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_async", + "title": "AnalyticsService exportAnalyticsMetrics Sample", + "origin": "API_DEFINITION", + "description": " Exports analytics metrics. `Operation.response` is of type `ExportAnalyticsMetricsResponse`. `Operation.metadata` is of type `ExportMetadata`.", + "canonical": true, + "file": "analytics_service.export_analytics_metrics.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportAnalyticsMetrics", + "fullName": "google.cloud.retail.v2.AnalyticsService.ExportAnalyticsMetrics", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "output_config", + "type": ".google.cloud.retail.v2.OutputConfig" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AnalyticsServiceClient", + "fullName": "google.cloud.retail.v2.AnalyticsServiceClient" + }, + "method": { + "shortName": "ExportAnalyticsMetrics", + "fullName": "google.cloud.retail.v2.AnalyticsService.ExportAnalyticsMetrics", + "service": { + "shortName": "AnalyticsService", + "fullName": "google.cloud.retail.v2.AnalyticsService" + } + } + } + }, { "regionTag": "retail_v2_generated_CatalogService_ListCatalogs_async", - "title": "CatalogService listCatalogs Sample", + "title": "AnalyticsService listCatalogs Sample", "origin": "API_DEFINITION", "description": " Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.", "canonical": true, @@ -61,7 +109,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_UpdateCatalog_async", - "title": "CatalogService updateCatalog Sample", + "title": "AnalyticsService updateCatalog Sample", "origin": "API_DEFINITION", "description": " Updates the [Catalog][google.cloud.retail.v2.Catalog]s.", "canonical": true, @@ -105,7 +153,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_SetDefaultBranch_async", - "title": "CatalogService setDefaultBranch Sample", + "title": "AnalyticsService setDefaultBranch Sample", "origin": "API_DEFINITION", "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", "canonical": true, @@ -157,7 +205,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_GetDefaultBranch_async", - "title": "CatalogService getDefaultBranch Sample", + "title": "AnalyticsService getDefaultBranch Sample", "origin": "API_DEFINITION", "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] method under a specified parent catalog.", "canonical": true, @@ -197,7 +245,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_GetCompletionConfig_async", - "title": "CatalogService getCompletionConfig Sample", + "title": "AnalyticsService getCompletionConfig Sample", "origin": "API_DEFINITION", "description": " Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].", "canonical": true, @@ -237,7 +285,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_UpdateCompletionConfig_async", - "title": "CatalogService updateCompletionConfig Sample", + "title": "AnalyticsService updateCompletionConfig Sample", "origin": "API_DEFINITION", "description": " Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.", "canonical": true, @@ -281,7 +329,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_GetAttributesConfig_async", - "title": "CatalogService getAttributesConfig Sample", + "title": "AnalyticsService getAttributesConfig Sample", "origin": "API_DEFINITION", "description": " Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].", "canonical": true, @@ -321,7 +369,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_UpdateAttributesConfig_async", - "title": "CatalogService updateAttributesConfig Sample", + "title": "AnalyticsService updateAttributesConfig Sample", "origin": "API_DEFINITION", "description": " Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", "canonical": true, @@ -365,7 +413,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_AddCatalogAttribute_async", - "title": "CatalogService addCatalogAttribute Sample", + "title": "AnalyticsService addCatalogAttribute Sample", "origin": "API_DEFINITION", "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", "canonical": true, @@ -409,7 +457,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_RemoveCatalogAttribute_async", - "title": "CatalogService removeCatalogAttribute Sample", + "title": "AnalyticsService removeCatalogAttribute Sample", "origin": "API_DEFINITION", "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", "canonical": true, @@ -453,7 +501,7 @@ }, { "regionTag": "retail_v2_generated_CatalogService_ReplaceCatalogAttribute_async", - "title": "CatalogService replaceCatalogAttribute Sample", + "title": "AnalyticsService replaceCatalogAttribute Sample", "origin": "API_DEFINITION", "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", "canonical": true, @@ -501,7 +549,7 @@ }, { "regionTag": "retail_v2_generated_CompletionService_CompleteQuery_async", - "title": "CatalogService completeQuery Sample", + "title": "AnalyticsService completeQuery Sample", "origin": "API_DEFINITION", "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, @@ -569,7 +617,7 @@ }, { "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", - "title": "CatalogService importCompletionData Sample", + "title": "AnalyticsService importCompletionData Sample", "origin": "API_DEFINITION", "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, @@ -617,7 +665,7 @@ }, { "regionTag": "retail_v2_generated_ControlService_CreateControl_async", - "title": "CatalogService createControl Sample", + "title": "AnalyticsService createControl Sample", "origin": "API_DEFINITION", "description": " Creates a Control. If the [Control][google.cloud.retail.v2.Control] to create already exists, an ALREADY_EXISTS error is returned.", "canonical": true, @@ -665,7 +713,7 @@ }, { "regionTag": "retail_v2_generated_ControlService_DeleteControl_async", - "title": "CatalogService deleteControl Sample", + "title": "AnalyticsService deleteControl Sample", "origin": "API_DEFINITION", "description": " Deletes a Control. If the [Control][google.cloud.retail.v2.Control] to delete does not exist, a NOT_FOUND error is returned.", "canonical": true, @@ -705,7 +753,7 @@ }, { "regionTag": "retail_v2_generated_ControlService_UpdateControl_async", - "title": "CatalogService updateControl Sample", + "title": "AnalyticsService updateControl Sample", "origin": "API_DEFINITION", "description": " Updates a Control. [Control][google.cloud.retail.v2.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2.Control] to update does not exist, a NOT_FOUND error is returned.", "canonical": true, @@ -749,7 +797,7 @@ }, { "regionTag": "retail_v2_generated_ControlService_GetControl_async", - "title": "CatalogService getControl Sample", + "title": "AnalyticsService getControl Sample", "origin": "API_DEFINITION", "description": " Gets a Control.", "canonical": true, @@ -789,7 +837,7 @@ }, { "regionTag": "retail_v2_generated_ControlService_ListControls_async", - "title": "CatalogService listControls Sample", + "title": "AnalyticsService listControls Sample", "origin": "API_DEFINITION", "description": " Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog].", "canonical": true, @@ -841,7 +889,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_CreateModel_async", - "title": "CatalogService createModel Sample", + "title": "AnalyticsService createModel Sample", "origin": "API_DEFINITION", "description": " Creates a new model.", "canonical": true, @@ -889,7 +937,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_GetModel_async", - "title": "CatalogService getModel Sample", + "title": "AnalyticsService getModel Sample", "origin": "API_DEFINITION", "description": " Gets a model.", "canonical": true, @@ -929,7 +977,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_PauseModel_async", - "title": "CatalogService pauseModel Sample", + "title": "AnalyticsService pauseModel Sample", "origin": "API_DEFINITION", "description": " Pauses the training of an existing model.", "canonical": true, @@ -969,7 +1017,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_ResumeModel_async", - "title": "CatalogService resumeModel Sample", + "title": "AnalyticsService resumeModel Sample", "origin": "API_DEFINITION", "description": " Resumes the training of an existing model.", "canonical": true, @@ -1009,7 +1057,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_DeleteModel_async", - "title": "CatalogService deleteModel Sample", + "title": "AnalyticsService deleteModel Sample", "origin": "API_DEFINITION", "description": " Deletes an existing model.", "canonical": true, @@ -1049,7 +1097,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_ListModels_async", - "title": "CatalogService listModels Sample", + "title": "AnalyticsService listModels Sample", "origin": "API_DEFINITION", "description": " Lists all the models linked to this event store.", "canonical": true, @@ -1097,7 +1145,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_UpdateModel_async", - "title": "CatalogService updateModel Sample", + "title": "AnalyticsService updateModel Sample", "origin": "API_DEFINITION", "description": " Update of model metadata. Only fields that currently can be updated are: `filtering_option` and `periodic_tuning_state`. If other values are provided, this API method ignores them.", "canonical": true, @@ -1141,7 +1189,7 @@ }, { "regionTag": "retail_v2_generated_ModelService_TuneModel_async", - "title": "CatalogService tuneModel Sample", + "title": "AnalyticsService tuneModel Sample", "origin": "API_DEFINITION", "description": " Tunes an existing model.", "canonical": true, @@ -1181,7 +1229,7 @@ }, { "regionTag": "retail_v2_generated_PredictionService_Predict_async", - "title": "CatalogService predict Sample", + "title": "AnalyticsService predict Sample", "origin": "API_DEFINITION", "description": " Makes a recommendation prediction.", "canonical": true, @@ -1249,7 +1297,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_CreateProduct_async", - "title": "CatalogService createProduct Sample", + "title": "AnalyticsService createProduct Sample", "origin": "API_DEFINITION", "description": " Creates a [Product][google.cloud.retail.v2.Product].", "canonical": true, @@ -1297,7 +1345,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_GetProduct_async", - "title": "CatalogService getProduct Sample", + "title": "AnalyticsService getProduct Sample", "origin": "API_DEFINITION", "description": " Gets a [Product][google.cloud.retail.v2.Product].", "canonical": true, @@ -1337,7 +1385,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_ListProducts_async", - "title": "CatalogService listProducts Sample", + "title": "AnalyticsService listProducts Sample", "origin": "API_DEFINITION", "description": " Gets a list of [Product][google.cloud.retail.v2.Product]s.", "canonical": true, @@ -1393,7 +1441,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_UpdateProduct_async", - "title": "CatalogService updateProduct Sample", + "title": "AnalyticsService updateProduct Sample", "origin": "API_DEFINITION", "description": " Updates a [Product][google.cloud.retail.v2.Product].", "canonical": true, @@ -1441,7 +1489,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_DeleteProduct_async", - "title": "CatalogService deleteProduct Sample", + "title": "AnalyticsService deleteProduct Sample", "origin": "API_DEFINITION", "description": " Deletes a [Product][google.cloud.retail.v2.Product].", "canonical": true, @@ -1481,7 +1529,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_ImportProducts_async", - "title": "CatalogService importProducts Sample", + "title": "AnalyticsService importProducts Sample", "origin": "API_DEFINITION", "description": " Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. Request processing may be synchronous. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to be successfully updated.", "canonical": true, @@ -1545,7 +1593,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_SetInventory_async", - "title": "CatalogService setInventory Sample", + "title": "AnalyticsService setInventory Sample", "origin": "API_DEFINITION", "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update is enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update times for the specified inventory fields are overwritten by the times of the [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product is used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information is preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates are not marked as [done][google.longrunning.Operation.done] until they are obsolete.", "canonical": true, @@ -1597,7 +1645,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", - "title": "CatalogService addFulfillmentPlaces Sample", + "title": "AnalyticsService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", "description": " It is recommended to use the [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] method instead of [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]. [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] achieves the same results but provides more fine-grained control over ingesting local inventory data. Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", "canonical": true, @@ -1653,7 +1701,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "CatalogService removeFulfillmentPlaces Sample", + "title": "AnalyticsService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", "description": " It is recommended to use the [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] method instead of [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] achieves the same results but provides more fine-grained control over ingesting local inventory data. Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", "canonical": true, @@ -1709,7 +1757,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_AddLocalInventories_async", - "title": "CatalogService addLocalInventories Sample", + "title": "AnalyticsService addLocalInventories Sample", "origin": "API_DEFINITION", "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", "canonical": true, @@ -1765,7 +1813,7 @@ }, { "regionTag": "retail_v2_generated_ProductService_RemoveLocalInventories_async", - "title": "CatalogService removeLocalInventories Sample", + "title": "AnalyticsService removeLocalInventories Sample", "origin": "API_DEFINITION", "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", "canonical": true, @@ -1817,7 +1865,7 @@ }, { "regionTag": "retail_v2_generated_SearchService_Search_async", - "title": "CatalogService search Sample", + "title": "AnalyticsService search Sample", "origin": "API_DEFINITION", "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, @@ -1941,7 +1989,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_CreateServingConfig_async", - "title": "CatalogService createServingConfig Sample", + "title": "AnalyticsService createServingConfig Sample", "origin": "API_DEFINITION", "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.", "canonical": true, @@ -1989,7 +2037,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_DeleteServingConfig_async", - "title": "CatalogService deleteServingConfig Sample", + "title": "AnalyticsService deleteServingConfig Sample", "origin": "API_DEFINITION", "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", "canonical": true, @@ -2029,7 +2077,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_UpdateServingConfig_async", - "title": "CatalogService updateServingConfig Sample", + "title": "AnalyticsService updateServingConfig Sample", "origin": "API_DEFINITION", "description": " Updates a ServingConfig.", "canonical": true, @@ -2073,7 +2121,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_GetServingConfig_async", - "title": "CatalogService getServingConfig Sample", + "title": "AnalyticsService getServingConfig Sample", "origin": "API_DEFINITION", "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", "canonical": true, @@ -2113,7 +2161,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_ListServingConfigs_async", - "title": "CatalogService listServingConfigs Sample", + "title": "AnalyticsService listServingConfigs Sample", "origin": "API_DEFINITION", "description": " Lists all ServingConfigs linked to this catalog.", "canonical": true, @@ -2161,7 +2209,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_AddControl_async", - "title": "CatalogService addControl Sample", + "title": "AnalyticsService addControl Sample", "origin": "API_DEFINITION", "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", "canonical": true, @@ -2205,7 +2253,7 @@ }, { "regionTag": "retail_v2_generated_ServingConfigService_RemoveControl_async", - "title": "CatalogService removeControl Sample", + "title": "AnalyticsService removeControl Sample", "origin": "API_DEFINITION", "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", "canonical": true, @@ -2249,7 +2297,7 @@ }, { "regionTag": "retail_v2_generated_UserEventService_WriteUserEvent_async", - "title": "CatalogService writeUserEvent Sample", + "title": "AnalyticsService writeUserEvent Sample", "origin": "API_DEFINITION", "description": " Writes a single user event.", "canonical": true, @@ -2297,7 +2345,7 @@ }, { "regionTag": "retail_v2_generated_UserEventService_CollectUserEvent_async", - "title": "CatalogService collectUserEvent Sample", + "title": "AnalyticsService collectUserEvent Sample", "origin": "API_DEFINITION", "description": " Writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain. This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users should not call this method directly.", "canonical": true, @@ -2357,7 +2405,7 @@ }, { "regionTag": "retail_v2_generated_UserEventService_PurgeUserEvents_async", - "title": "CatalogService purgeUserEvents Sample", + "title": "AnalyticsService purgeUserEvents Sample", "origin": "API_DEFINITION", "description": " Deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.", "canonical": true, @@ -2405,7 +2453,7 @@ }, { "regionTag": "retail_v2_generated_UserEventService_ImportUserEvents_async", - "title": "CatalogService importUserEvents Sample", + "title": "AnalyticsService importUserEvents Sample", "origin": "API_DEFINITION", "description": " Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events. `Operation.response` is of type `ImportResponse`. Note that it is possible for a subset of the items to be successfully inserted. `Operation.metadata` is of type `ImportMetadata`.", "canonical": true, @@ -2453,7 +2501,7 @@ }, { "regionTag": "retail_v2_generated_UserEventService_RejoinUserEvents_async", - "title": "CatalogService rejoinUserEvents Sample", + "title": "AnalyticsService rejoinUserEvents Sample", "origin": "API_DEFINITION", "description": " Starts a user-event rejoin operation with latest product catalog. Events are not annotated with detailed product information for products that are missing from the catalog when the user event is ingested. These events are stored as unjoined events with limited usage on training and serving. You can use this method to start a join operation on specified events with the latest version of product catalog. You can also use this method to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", "canonical": true, diff --git a/packages/google-cloud-retail/src/v2/analytics_service_client.ts b/packages/google-cloud-retail/src/v2/analytics_service_client.ts new file mode 100644 index 00000000000..285555cf323 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/analytics_service_client.ts @@ -0,0 +1,1323 @@ +// Copyright 2024 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, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); + +/** + * Client JSON configuration object, loaded from + * `src/v2/analytics_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './analytics_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing & accessing retail search business metric. + * Retail recommendation business metric is currently not available. + * @class + * @memberof v2 + */ +export class AnalyticsServiceClient { + 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; + 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; + analyticsServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AnalyticsServiceClient. + * + * @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://developers.google.com/identity/protocols/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 AnalyticsServiceClient({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 AnalyticsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'retail.' + 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 !== 'undefined' && '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 = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const exportAnalyticsMetricsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ExportAnalyticsMetricsResponse' + ) as gax.protobuf.Type; + const exportAnalyticsMetricsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ExportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + exportAnalyticsMetrics: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAnalyticsMetricsResponse.decode.bind( + exportAnalyticsMetricsResponse + ), + exportAnalyticsMetricsMetadata.decode.bind( + exportAnalyticsMetricsMetadata + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.AnalyticsService', + 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.analyticsServiceStub) { + return this.analyticsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.AnalyticsService. + this.analyticsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.AnalyticsService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.AnalyticsService, + 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 analyticsServiceStubMethods = ['exportAnalyticsMetrics']; + for (const methodName of analyticsServiceStubMethods) { + const callPromise = this.analyticsServiceStub.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.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.analyticsServiceStub; + } + + /** + * 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 !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } + return 'retail.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 !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } + return 'retail.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']; + } + + 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 -- + // ------------------- + + /** + * Exports analytics metrics. + * + * `Operation.response` is of type `ExportAnalyticsMetricsResponse`. + * `Operation.metadata` is of type `ExportMetadata`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Required. Full resource name of the parent catalog. + * Expected format: `projects/* /locations/* /catalogs/*` + * @param {google.cloud.retail.v2.OutputConfig} request.outputConfig + * Required. The output location of the data. + * @param {string} request.filter + * A filtering expression to specify restrictions on returned metrics. + * The expression is a sequence of terms. Each term applies a restriction to + * the returned metrics. Use this expression to restrict results to a + * specific time range. + * + * Currently we expect only one types of fields: + * + * * `timestamp`: This can be specified twice, once with a + * less than operator and once with a greater than operator. The + * `timestamp` restriction should result in one, contiguous, valid, + * `timestamp` range. + * + * Some examples of valid filters expressions: + * + * * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" + * timestamp < "2012-04-23T18:30:43.511Z"` + * * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` + * @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/v2/analytics_service.export_analytics_metrics.js + * region_tag:retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_async + */ + exportAnalyticsMetrics( + request?: protos.google.cloud.retail.v2.IExportAnalyticsMetricsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + exportAnalyticsMetrics( + request: protos.google.cloud.retail.v2.IExportAnalyticsMetricsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAnalyticsMetrics( + request: protos.google.cloud.retail.v2.IExportAnalyticsMetricsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAnalyticsMetrics( + request?: protos.google.cloud.retail.v2.IExportAnalyticsMetricsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >, + 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({ + catalog: request.catalog ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportAnalyticsMetrics( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `exportAnalyticsMetrics()`. + * @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/v2/analytics_service.export_analytics_metrics.js + * region_tag:retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_async + */ + async checkExportAnalyticsMetricsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.ExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.ExportMetadata + > + > { + 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.exportAnalyticsMetrics, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.ExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.ExportMetadata + >; + } + /** + * 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, + options?: + | 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]> { + 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 { + 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, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + 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, + options?: + | 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 { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * 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.analyticsServiceStub && !this._terminated) { + return this.analyticsServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/analytics_service_client_config.json b/packages/google-cloud-retail/src/v2/analytics_service_client_config.json new file mode 100644 index 00000000000..bb1985309d0 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/analytics_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2.AnalyticsService": { + "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": { + "ExportAnalyticsMetrics": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/analytics_service_proto_list.json b/packages/google-cloud-retail/src/v2/analytics_service_proto_list.json new file mode 100644 index 00000000000..17eb9aae687 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/analytics_service_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/retail/v2/analytics_service.proto", + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/model.proto", + "../../protos/google/cloud/retail/v2/model_service.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/control_service_proto_list.json b/packages/google-cloud-retail/src/v2/control_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/control_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/control_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/gapic_metadata.json b/packages/google-cloud-retail/src/v2/gapic_metadata.json index 78e1ab8635a..67732385f14 100644 --- a/packages/google-cloud-retail/src/v2/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2/gapic_metadata.json @@ -5,6 +5,30 @@ "protoPackage": "google.cloud.retail.v2", "libraryPackage": "@google-cloud/retail", "services": { + "AnalyticsService": { + "clients": { + "grpc": { + "libraryClient": "AnalyticsServiceClient", + "rpcs": { + "ExportAnalyticsMetrics": { + "methods": [ + "exportAnalyticsMetrics" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AnalyticsServiceClient", + "rpcs": { + "ExportAnalyticsMetrics": { + "methods": [ + "exportAnalyticsMetrics" + ] + } + } + } + } + }, "CatalogService": { "clients": { "grpc": { diff --git a/packages/google-cloud-retail/src/v2/index.ts b/packages/google-cloud-retail/src/v2/index.ts index 1d625bd40f2..251f0609a5a 100644 --- a/packages/google-cloud-retail/src/v2/index.ts +++ b/packages/google-cloud-retail/src/v2/index.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +export {AnalyticsServiceClient} from './analytics_service_client'; export {CatalogServiceClient} from './catalog_service_client'; export {CompletionServiceClient} from './completion_service_client'; export {ControlServiceClient} from './control_service_client'; diff --git a/packages/google-cloud-retail/src/v2/model_service_proto_list.json b/packages/google-cloud-retail/src/v2/model_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/model_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/model_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/product_service_proto_list.json b/packages/google-cloud-retail/src/v2/product_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/product_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/search_service_proto_list.json b/packages/google-cloud-retail/src/v2/search_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/search_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json b/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json index b31d21dbd95..17eb9aae687 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json @@ -1,10 +1,12 @@ [ + "../../protos/google/cloud/retail/v2/analytics_service.proto", "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/control.proto", "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/export_config.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/model.proto", "../../protos/google/cloud/retail/v2/model_service.proto", diff --git a/packages/google-cloud-retail/test/gapic_analytics_service_v2.ts b/packages/google-cloud-retail/test/gapic_analytics_service_v2.ts new file mode 100644 index 00000000000..ae7863ac597 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_analytics_service_v2.ts @@ -0,0 +1,1479 @@ +// Copyright 2024 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 analyticsserviceModule from '../src'; + +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 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 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('v2.AnalyticsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + analyticsserviceModule.v2.AnalyticsServiceClient.servicePath; + assert.strictEqual(servicePath, 'retail.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + analyticsserviceModule.v2.AnalyticsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'retail.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'retail.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new analyticsserviceModule.v2.AnalyticsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = analyticsserviceModule.v2.AnalyticsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.analyticsServiceStub, undefined); + await client.initialize(); + assert(client.analyticsServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.analyticsServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.analyticsServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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('exportAnalyticsMetrics', () => { + it('invokes exportAnalyticsMetrics without error', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ExportAnalyticsMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ExportAnalyticsMetricsRequest', + ['catalog'] + ); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAnalyticsMetrics = + stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAnalyticsMetrics(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAnalyticsMetrics without error using callback', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ExportAnalyticsMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ExportAnalyticsMetricsRequest', + ['catalog'] + ); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAnalyticsMetrics = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportAnalyticsMetrics( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IExportAnalyticsMetricsResponse, + protos.google.cloud.retail.v2.IExportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAnalyticsMetrics with call error', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ExportAnalyticsMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ExportAnalyticsMetricsRequest', + ['catalog'] + ); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.exportAnalyticsMetrics(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAnalyticsMetrics with LRO error', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ExportAnalyticsMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ExportAnalyticsMetricsRequest', + ['catalog'] + ); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportAnalyticsMetrics(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAnalyticsMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportAnalyticsMetricsProgress without error', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkExportAnalyticsMetricsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAnalyticsMetricsProgress with error', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkExportAnalyticsMetricsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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); + } + } + ); + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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); + } + } + ); + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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); + } + } + ); + }); + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + 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.ListOperationsResponse[] = + []; + 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 analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.ListOperationsResponse[] = + []; + 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('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new analyticsserviceModule.v2.AnalyticsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});