@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
1,119 lines • 89.7 kB
JavaScript
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.2
// protoc v3.21.12
// source: google/ads/googleads/v24/services/benchmarks_service.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BenchmarksServiceClient = exports.BenchmarksServiceService = exports.RateMetrics = exports.Metrics = exports.BreakdownKey = exports.BreakdownMetrics = exports.GenerateBenchmarksMetricsResponse = exports.BreakdownDefinition = exports.ProductFilter_MarketingObjectiveList = exports.ProductFilter_ProductList = exports.ProductFilter = exports.BenchmarksSource = exports.GenerateBenchmarksMetricsRequest = exports.IndustryVerticalInfo = exports.BenchmarksSourceMetadata = exports.ListBenchmarksSourcesResponse = exports.ListBenchmarksSourcesRequest = exports.BenchmarksProductMetadata = exports.ListBenchmarksProductsResponse = exports.ListBenchmarksProductsRequest = exports.BenchmarksLocation = exports.ListBenchmarksLocationsResponse = exports.ListBenchmarksLocationsRequest = exports.ListBenchmarksAvailableDatesResponse = exports.ListBenchmarksAvailableDatesRequest = void 0;
/* eslint-disable */
const grpc_js_1 = require("@grpc/grpc-js");
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const additional_application_info_js_1 = require("../common/additional_application_info.js");
const criteria_js_1 = require("../common/criteria.js");
const dates_js_1 = require("../common/dates.js");
const benchmarks_marketing_objective_js_1 = require("../enums/benchmarks_marketing_objective.js");
const benchmarks_source_type_js_1 = require("../enums/benchmarks_source_type.js");
const benchmarks_time_granularity_js_1 = require("../enums/benchmarks_time_granularity.js");
function createBaseListBenchmarksAvailableDatesRequest() {
return { application_info: undefined };
}
exports.ListBenchmarksAvailableDatesRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.application_info, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksAvailableDatesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
application_info: isSet(object.application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.application_info !== undefined) {
obj.application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.application_info);
}
return obj;
},
create(base) {
return exports.ListBenchmarksAvailableDatesRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseListBenchmarksAvailableDatesRequest();
message.application_info = (object.application_info !== undefined && object.application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.application_info)
: undefined;
return message;
},
};
function createBaseListBenchmarksAvailableDatesResponse() {
return { supported_dates: undefined };
}
exports.ListBenchmarksAvailableDatesResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.supported_dates !== undefined) {
dates_js_1.DateRange.encode(message.supported_dates, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksAvailableDatesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.supported_dates = dates_js_1.DateRange.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { supported_dates: isSet(object.supported_dates) ? dates_js_1.DateRange.fromJSON(object.supported_dates) : undefined };
},
toJSON(message) {
const obj = {};
if (message.supported_dates !== undefined) {
obj.supported_dates = dates_js_1.DateRange.toJSON(message.supported_dates);
}
return obj;
},
create(base) {
return exports.ListBenchmarksAvailableDatesResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseListBenchmarksAvailableDatesResponse();
message.supported_dates = (object.supported_dates !== undefined && object.supported_dates !== null)
? dates_js_1.DateRange.fromPartial(object.supported_dates)
: undefined;
return message;
},
};
function createBaseListBenchmarksLocationsRequest() {
return { application_info: undefined };
}
exports.ListBenchmarksLocationsRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.application_info, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksLocationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
application_info: isSet(object.application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.application_info !== undefined) {
obj.application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.application_info);
}
return obj;
},
create(base) {
return exports.ListBenchmarksLocationsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseListBenchmarksLocationsRequest();
message.application_info = (object.application_info !== undefined && object.application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.application_info)
: undefined;
return message;
},
};
function createBaseListBenchmarksLocationsResponse() {
return { benchmarks_locations: [] };
}
exports.ListBenchmarksLocationsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.benchmarks_locations !== undefined && message.benchmarks_locations.length !== 0) {
for (const v of message.benchmarks_locations) {
exports.BenchmarksLocation.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksLocationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.benchmarks_locations.push(exports.BenchmarksLocation.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
benchmarks_locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.benchmarks_locations)
? object.benchmarks_locations.map((e) => exports.BenchmarksLocation.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.benchmarks_locations) === null || _a === void 0 ? void 0 : _a.length) {
obj.benchmarks_locations = message.benchmarks_locations.map((e) => exports.BenchmarksLocation.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListBenchmarksLocationsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListBenchmarksLocationsResponse();
message.benchmarks_locations = ((_a = object.benchmarks_locations) === null || _a === void 0 ? void 0 : _a.map((e) => exports.BenchmarksLocation.fromPartial(e))) || [];
return message;
},
};
function createBaseBenchmarksLocation() {
return { location_name: "", location_type: "", location_info: undefined };
}
exports.BenchmarksLocation = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.location_name !== undefined && message.location_name !== "") {
writer.uint32(10).string(message.location_name);
}
if (message.location_type !== undefined && message.location_type !== "") {
writer.uint32(18).string(message.location_type);
}
if (message.location_info !== undefined) {
criteria_js_1.LocationInfo.encode(message.location_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBenchmarksLocation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.location_name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.location_type = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.location_info = criteria_js_1.LocationInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
location_name: isSet(object.location_name) ? globalThis.String(object.location_name) : "",
location_type: isSet(object.location_type) ? globalThis.String(object.location_type) : "",
location_info: isSet(object.location_info) ? criteria_js_1.LocationInfo.fromJSON(object.location_info) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.location_name !== undefined && message.location_name !== "") {
obj.location_name = message.location_name;
}
if (message.location_type !== undefined && message.location_type !== "") {
obj.location_type = message.location_type;
}
if (message.location_info !== undefined) {
obj.location_info = criteria_js_1.LocationInfo.toJSON(message.location_info);
}
return obj;
},
create(base) {
return exports.BenchmarksLocation.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseBenchmarksLocation();
message.location_name = (_a = object.location_name) !== null && _a !== void 0 ? _a : "";
message.location_type = (_b = object.location_type) !== null && _b !== void 0 ? _b : "";
message.location_info = (object.location_info !== undefined && object.location_info !== null)
? criteria_js_1.LocationInfo.fromPartial(object.location_info)
: undefined;
return message;
},
};
function createBaseListBenchmarksProductsRequest() {
return { application_info: undefined };
}
exports.ListBenchmarksProductsRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.application_info, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksProductsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
application_info: isSet(object.application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.application_info !== undefined) {
obj.application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.application_info);
}
return obj;
},
create(base) {
return exports.ListBenchmarksProductsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseListBenchmarksProductsRequest();
message.application_info = (object.application_info !== undefined && object.application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.application_info)
: undefined;
return message;
},
};
function createBaseListBenchmarksProductsResponse() {
return { benchmarks_products: [] };
}
exports.ListBenchmarksProductsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.benchmarks_products !== undefined && message.benchmarks_products.length !== 0) {
for (const v of message.benchmarks_products) {
exports.BenchmarksProductMetadata.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksProductsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.benchmarks_products.push(exports.BenchmarksProductMetadata.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
benchmarks_products: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.benchmarks_products)
? object.benchmarks_products.map((e) => exports.BenchmarksProductMetadata.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.benchmarks_products) === null || _a === void 0 ? void 0 : _a.length) {
obj.benchmarks_products = message.benchmarks_products.map((e) => exports.BenchmarksProductMetadata.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListBenchmarksProductsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListBenchmarksProductsResponse();
message.benchmarks_products = ((_a = object.benchmarks_products) === null || _a === void 0 ? void 0 : _a.map((e) => exports.BenchmarksProductMetadata.fromPartial(e))) ||
[];
return message;
},
};
function createBaseBenchmarksProductMetadata() {
return { product_name: "", product_code: "", marketing_objective: 0 };
}
exports.BenchmarksProductMetadata = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.product_name !== undefined && message.product_name !== "") {
writer.uint32(10).string(message.product_name);
}
if (message.product_code !== undefined && message.product_code !== "") {
writer.uint32(18).string(message.product_code);
}
if (message.marketing_objective !== undefined && message.marketing_objective !== 0) {
writer.uint32(24).int32(message.marketing_objective);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBenchmarksProductMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.product_name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.product_code = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.marketing_objective = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
product_name: isSet(object.product_name) ? globalThis.String(object.product_name) : "",
product_code: isSet(object.product_code) ? globalThis.String(object.product_code) : "",
marketing_objective: isSet(object.marketing_objective)
? (0, benchmarks_marketing_objective_js_1.benchmarksMarketingObjectiveEnum_BenchmarksMarketingObjectiveFromJSON)(object.marketing_objective)
: 0,
};
},
toJSON(message) {
const obj = {};
if (message.product_name !== undefined && message.product_name !== "") {
obj.product_name = message.product_name;
}
if (message.product_code !== undefined && message.product_code !== "") {
obj.product_code = message.product_code;
}
if (message.marketing_objective !== undefined && message.marketing_objective !== 0) {
obj.marketing_objective = (0, benchmarks_marketing_objective_js_1.benchmarksMarketingObjectiveEnum_BenchmarksMarketingObjectiveToJSON)(message.marketing_objective);
}
return obj;
},
create(base) {
return exports.BenchmarksProductMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseBenchmarksProductMetadata();
message.product_name = (_a = object.product_name) !== null && _a !== void 0 ? _a : "";
message.product_code = (_b = object.product_code) !== null && _b !== void 0 ? _b : "";
message.marketing_objective = (_c = object.marketing_objective) !== null && _c !== void 0 ? _c : 0;
return message;
},
};
function createBaseListBenchmarksSourcesRequest() {
return { benchmarks_sources: [], application_info: undefined };
}
exports.ListBenchmarksSourcesRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.benchmarks_sources !== undefined && message.benchmarks_sources.length !== 0) {
writer.uint32(10).fork();
for (const v of message.benchmarks_sources) {
writer.int32(v);
}
writer.ldelim();
}
if (message.application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.application_info, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksSourcesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag === 8) {
message.benchmarks_sources.push(reader.int32());
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.benchmarks_sources.push(reader.int32());
}
continue;
}
break;
case 2:
if (tag !== 18) {
break;
}
message.application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
benchmarks_sources: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.benchmarks_sources)
? object.benchmarks_sources.map((e) => (0, benchmarks_source_type_js_1.benchmarksSourceTypeEnum_BenchmarksSourceTypeFromJSON)(e))
: [],
application_info: isSet(object.application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.application_info)
: undefined,
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.benchmarks_sources) === null || _a === void 0 ? void 0 : _a.length) {
obj.benchmarks_sources = message.benchmarks_sources.map((e) => (0, benchmarks_source_type_js_1.benchmarksSourceTypeEnum_BenchmarksSourceTypeToJSON)(e));
}
if (message.application_info !== undefined) {
obj.application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.application_info);
}
return obj;
},
create(base) {
return exports.ListBenchmarksSourcesRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListBenchmarksSourcesRequest();
message.benchmarks_sources = ((_a = object.benchmarks_sources) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
message.application_info = (object.application_info !== undefined && object.application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.application_info)
: undefined;
return message;
},
};
function createBaseListBenchmarksSourcesResponse() {
return { benchmarks_sources: [] };
}
exports.ListBenchmarksSourcesResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.benchmarks_sources !== undefined && message.benchmarks_sources.length !== 0) {
for (const v of message.benchmarks_sources) {
exports.BenchmarksSourceMetadata.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListBenchmarksSourcesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.benchmarks_sources.push(exports.BenchmarksSourceMetadata.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
benchmarks_sources: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.benchmarks_sources)
? object.benchmarks_sources.map((e) => exports.BenchmarksSourceMetadata.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.benchmarks_sources) === null || _a === void 0 ? void 0 : _a.length) {
obj.benchmarks_sources = message.benchmarks_sources.map((e) => exports.BenchmarksSourceMetadata.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListBenchmarksSourcesResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListBenchmarksSourcesResponse();
message.benchmarks_sources = ((_a = object.benchmarks_sources) === null || _a === void 0 ? void 0 : _a.map((e) => exports.BenchmarksSourceMetadata.fromPartial(e))) || [];
return message;
},
};
function createBaseBenchmarksSourceMetadata() {
return { benchmarks_source_type: 0, industry_vertical_info: undefined };
}
exports.BenchmarksSourceMetadata = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.benchmarks_source_type !== undefined && message.benchmarks_source_type !== 0) {
writer.uint32(8).int32(message.benchmarks_source_type);
}
if (message.industry_vertical_info !== undefined) {
exports.IndustryVerticalInfo.encode(message.industry_vertical_info, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBenchmarksSourceMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.benchmarks_source_type = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.industry_vertical_info = exports.IndustryVerticalInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
benchmarks_source_type: isSet(object.benchmarks_source_type)
? (0, benchmarks_source_type_js_1.benchmarksSourceTypeEnum_BenchmarksSourceTypeFromJSON)(object.benchmarks_source_type)
: 0,
industry_vertical_info: isSet(object.industry_vertical_info)
? exports.IndustryVerticalInfo.fromJSON(object.industry_vertical_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.benchmarks_source_type !== undefined && message.benchmarks_source_type !== 0) {
obj.benchmarks_source_type = (0, benchmarks_source_type_js_1.benchmarksSourceTypeEnum_BenchmarksSourceTypeToJSON)(message.benchmarks_source_type);
}
if (message.industry_vertical_info !== undefined) {
obj.industry_vertical_info = exports.IndustryVerticalInfo.toJSON(message.industry_vertical_info);
}
return obj;
},
create(base) {
return exports.BenchmarksSourceMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseBenchmarksSourceMetadata();
message.benchmarks_source_type = (_a = object.benchmarks_source_type) !== null && _a !== void 0 ? _a : 0;
message.industry_vertical_info =
(object.industry_vertical_info !== undefined && object.industry_vertical_info !== null)
? exports.IndustryVerticalInfo.fromPartial(object.industry_vertical_info)
: undefined;
return message;
},
};
function createBaseIndustryVerticalInfo() {
return { industry_vertical_name: "", industry_vertical_id: "0", parent_industry_vertical_id: "0" };
}
exports.IndustryVerticalInfo = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.industry_vertical_name !== undefined && message.industry_vertical_name !== "") {
writer.uint32(10).string(message.industry_vertical_name);
}
if (message.industry_vertical_id !== undefined && message.industry_vertical_id !== "0") {
writer.uint32(16).int64(message.industry_vertical_id);
}
if (message.parent_industry_vertical_id !== undefined && message.parent_industry_vertical_id !== "0") {
writer.uint32(24).int64(message.parent_industry_vertical_id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseIndustryVerticalInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.industry_vertical_name = reader.string();
continue;
case 2:
if (tag !== 16) {
break;
}
message.industry_vertical_id = longToString(reader.int64());
continue;
case 3:
if (tag !== 24) {
break;
}
message.parent_industry_vertical_id = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
industry_vertical_name: isSet(object.industry_vertical_name)
? globalThis.String(object.industry_vertical_name)
: "",
industry_vertical_id: isSet(object.industry_vertical_id) ? globalThis.String(object.industry_vertical_id) : "0",
parent_industry_vertical_id: isSet(object.parent_industry_vertical_id)
? globalThis.String(object.parent_industry_vertical_id)
: "0",
};
},
toJSON(message) {
const obj = {};
if (message.industry_vertical_name !== undefined && message.industry_vertical_name !== "") {
obj.industry_vertical_name = message.industry_vertical_name;
}
if (message.industry_vertical_id !== undefined && message.industry_vertical_id !== "0") {
obj.industry_vertical_id = message.industry_vertical_id;
}
if (message.parent_industry_vertical_id !== undefined && message.parent_industry_vertical_id !== "0") {
obj.parent_industry_vertical_id = message.parent_industry_vertical_id;
}
return obj;
},
create(base) {
return exports.IndustryVerticalInfo.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseIndustryVerticalInfo();
message.industry_vertical_name = (_a = object.industry_vertical_name) !== null && _a !== void 0 ? _a : "";
message.industry_vertical_id = (_b = object.industry_vertical_id) !== null && _b !== void 0 ? _b : "0";
message.parent_industry_vertical_id = (_c = object.parent_industry_vertical_id) !== null && _c !== void 0 ? _c : "0";
return message;
},
};
function createBaseGenerateBenchmarksMetricsRequest() {
return {
customer_id: "",
date_range: undefined,
location: undefined,
benchmarks_source: undefined,
product_filter: undefined,
breakdown_definition: undefined,
currency_code: "",
customer_benchmarks_group: "",
application_info: undefined,
};
}
exports.GenerateBenchmarksMetricsRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.customer_id !== undefined && message.customer_id !== "") {
writer.uint32(10).string(message.customer_id);
}
if (message.date_range !== undefined) {
dates_js_1.DateRange.encode(message.date_range, writer.uint32(18).fork()).ldelim();
}
if (message.location !== undefined) {
criteria_js_1.LocationInfo.encode(message.location, writer.uint32(26).fork()).ldelim();
}
if (message.benchmarks_source !== undefined) {
exports.BenchmarksSource.encode(message.benchmarks_source, writer.uint32(34).fork()).ldelim();
}
if (message.product_filter !== undefined) {
exports.ProductFilter.encode(message.product_filter, writer.uint32(42).fork()).ldelim();
}
if (message.breakdown_definition !== undefined) {
exports.BreakdownDefinition.encode(message.breakdown_definition, writer.uint32(74).fork()).ldelim();
}
if (message.currency_code !== undefined && message.currency_code !== "") {
writer.uint32(50).string(message.currency_code);
}
if (message.customer_benchmarks_group !== undefined && message.customer_benchmarks_group !== "") {
writer.uint32(58).string(message.customer_benchmarks_group);
}
if (message.application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.application_info, writer.uint32(66).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenerateBenchmarksMetricsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.customer_id = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.date_range = dates_js_1.DateRange.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.location = criteria_js_1.LocationInfo.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.benchmarks_source = exports.BenchmarksSource.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
break;
}
message.product_filter = exports.ProductFilter.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 74) {
break;
}
message.breakdown_definition = exports.BreakdownDefinition.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
message.currency_code = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.customer_benchmarks_group = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
customer_id: isSet(object.customer_id) ? globalThis.String(object.customer_id) : "",
date_range: isSet(object.date_range) ? dates_js_1.DateRange.fromJSON(object.date_range) : undefined,
location: isSet(object.location) ? criteria_js_1.LocationInfo.fromJSON(object.location) : undefined,
benchmarks_source: isSet(object.benchmarks_source)
? exports.BenchmarksSource.fromJSON(object.benchmarks_source)
: undefined,
product_filter: isSet(object.product_filter) ? exports.ProductFilter.fromJSON(object.product_filter) : undefined,
breakdown_definition: isSet(object.breakdown_definition)
? exports.BreakdownDefinition.fromJSON(object.breakdown_definition)
: undefined,
currency_code: isSet(object.currency_code) ? globalThis.String(object.currency_code) : "",
customer_benchmarks_group: isSet(object.customer_benchmarks_group)
? globalThis.String(object.customer_benchmarks_group)
: "",
application_info: isSet(object.application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.customer_id !== undefined && message.customer_id !== "") {
obj.customer_id = message.customer_id;
}
if (message.date_range !== undefined) {
obj.date_range = dates_js_1.DateRange.toJSON(message.date_range);
}
if (message.location !== undefined) {
obj.location = criteria_js_1.LocationInfo.toJSON(message.location);
}
if (message.benchmarks_source !== undefined) {
obj.benchmarks_source = exports.BenchmarksSource.toJSON(message.benchmarks_source);
}
if (message.product_filter !== undefined) {
obj.product_filter = exports.ProductFilter.toJSON(message.product_filter);
}
if (message.breakdown_definition !== undefined) {
obj.breakdown_definition = exports.BreakdownDefinition.toJSON(message.breakdown_definition);
}
if (message.currency_code !== undefined && message.currency_code !== "") {
obj.currency_code = message.currency_code;
}
if (message.customer_benchmarks_group !== undefined && message.customer_benchmarks_group !== "") {
obj.customer_benchmarks_group = message.customer_benchmarks_group;
}
if (message.application_info !== undefined) {
obj.application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.application_info);
}
return obj;
},
create(base) {
return exports.GenerateBenchmarksMetricsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseGenerateBenchmarksMetricsRequest();
message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : "";
message.date_range = (object.date_range !== undefined && object.date_range !== null)
? dates_js_1.DateRange.fromPartial(object.date_range)
: undefined;
message.location = (object.location !== undefined && object.location !== null)
? criteria_js_1.LocationInfo.fromPartial(object.location)
: undefined;
message.benchmarks_source = (object.benchmarks_source !== undefined && object.benchmarks_source !== null)
? exports.BenchmarksSource.fromPartial(object.benchmarks_source)
: undefined;
message.product_filter = (object.product_filter !== undefined && object.product_filter !== null)
? exports.ProductFilter.fromPartial(object.product_filter)
: undefined;
message.breakdown_definition = (object.breakdown_definition !== undefined && object.breakdown_definition !== null)
? exports.BreakdownDefinition.fromPartial(object.breakdown_definition)
: undefined;
message.currency_code = (_b = object.currency_code) !== null && _b !== void 0 ? _b : "";
message.customer_benchmarks_group = (_c = object.customer_benchmarks_group) !== null && _c !== void 0 ? _c : "";
message.application_info = (object.application_info !== undefined && object.application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.application_info)
: undefined;
return message;
},
};
function createBaseBenchmarksSource() {
return { industry_vertical_id: undefined };
}
exports.BenchmarksSource = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.industry_vertical_id !== undefined) {
writer.uint32(8).int64(message.industry_vertical_id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBenchmarksSource();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.industry_vertical_id = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
industry_vertical_id: isSet(object.industry_vertical_id)
? globalThis.String(object.industry_vertical_id)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.industry_vertical_id !== undefined) {
obj.industry_vertical_id = message.industry_vertical_id;
}
return obj;
},
create(base) {
return exports.BenchmarksSource.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseBenchmarksSource();
message.industry_vertical_id = (_a = object.industry_vertical_id) !== null && _a !== void 0 ? _a : undefined;
return message;
},
};
function createBaseProductFilter() {
return { product_list: undefined, marketing_objective_list: undefined };
}
exports.ProductFilter = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.product_list !== undefined) {
exports.ProductFilter_ProductList.encode(message.product_list, writer.uint32(10).fork()).ldelim();
}
if (message.marketing_objective_list !== undefined) {
exports.ProductFilter_MarketingObjectiveList.encode(message.marketing_objective_list, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProductFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.product_list = exports.ProductFilter_ProductList.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.marketing_objective_list = exports.ProductFilter_MarketingObjectiveList.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
product_list: isSet(object.p