UNPKG

@google-cloud/retail

Version:
809 lines (740 loc) 14.2 MB
// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ (function(global, factory) { /* global define, require, module */ /* AMD */ if (typeof define === 'function' && define.amd) define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); })(this, function($protobuf) { "use strict"; // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots._google_cloud_retail_protos || ($protobuf.roots._google_cloud_retail_protos = {}); $root.google = (function() { /** * Namespace google. * @exports google * @namespace */ var google = {}; google.cloud = (function() { /** * Namespace cloud. * @memberof google * @namespace */ var cloud = {}; cloud.retail = (function() { /** * Namespace retail. * @memberof google.cloud * @namespace */ var retail = {}; retail.v2 = (function() { /** * Namespace v2. * @memberof google.cloud.retail * @namespace */ 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<google.longrunning.Operation>} 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, error) { 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(); if (tag === error) break; 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.<string,*>} 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.<string,*>} 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.<string,*>} 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.<string,*>} 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, error) { 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(); if (tag === error) break; 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.<string,*>} 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.<string,*>} 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.<string,*>} 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.<string,*>} 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, error) { 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(); if (tag === error) break; 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.<string,*>} 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.<string,*>} 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.<string,*>} Plain object */ BigQueryDestination.toObject = function toObject(message, options) {