UNPKG

@htdangkhoa/google-ads

Version:
238 lines (237 loc) 11.4 kB
"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/v19/resources/ad_group_simulation.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AdGroupSimulation = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_js_1 = __importDefault(require("protobufjs/minimal.js")); const simulation_js_1 = require("../common/simulation.js"); const simulation_modification_method_js_1 = require("../enums/simulation_modification_method.js"); const simulation_type_js_1 = require("../enums/simulation_type.js"); function createBaseAdGroupSimulation() { return { resource_name: "", ad_group_id: undefined, type: 0, modification_method: 0, start_date: undefined, end_date: undefined, cpc_bid_point_list: undefined, cpv_bid_point_list: undefined, target_cpa_point_list: undefined, target_roas_point_list: undefined, }; } exports.AdGroupSimulation = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.resource_name !== undefined && message.resource_name !== "") { writer.uint32(10).string(message.resource_name); } if (message.ad_group_id !== undefined) { writer.uint32(96).int64(message.ad_group_id); } if (message.type !== undefined && message.type !== 0) { writer.uint32(24).int32(message.type); } if (message.modification_method !== undefined && message.modification_method !== 0) { writer.uint32(32).int32(message.modification_method); } if (message.start_date !== undefined) { writer.uint32(106).string(message.start_date); } if (message.end_date !== undefined) { writer.uint32(114).string(message.end_date); } if (message.cpc_bid_point_list !== undefined) { simulation_js_1.CpcBidSimulationPointList.encode(message.cpc_bid_point_list, writer.uint32(66).fork()).ldelim(); } if (message.cpv_bid_point_list !== undefined) { simulation_js_1.CpvBidSimulationPointList.encode(message.cpv_bid_point_list, writer.uint32(82).fork()).ldelim(); } if (message.target_cpa_point_list !== undefined) { simulation_js_1.TargetCpaSimulationPointList.encode(message.target_cpa_point_list, writer.uint32(74).fork()).ldelim(); } if (message.target_roas_point_list !== undefined) { simulation_js_1.TargetRoasSimulationPointList.encode(message.target_roas_point_list, writer.uint32(90).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 = createBaseAdGroupSimulation(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 12: if (tag !== 96) { break; } message.ad_group_id = longToString(reader.int64()); continue; case 3: if (tag !== 24) { break; } message.type = reader.int32(); continue; case 4: if (tag !== 32) { break; } message.modification_method = reader.int32(); continue; case 13: if (tag !== 106) { break; } message.start_date = reader.string(); continue; case 14: if (tag !== 114) { break; } message.end_date = reader.string(); continue; case 8: if (tag !== 66) { break; } message.cpc_bid_point_list = simulation_js_1.CpcBidSimulationPointList.decode(reader, reader.uint32()); continue; case 10: if (tag !== 82) { break; } message.cpv_bid_point_list = simulation_js_1.CpvBidSimulationPointList.decode(reader, reader.uint32()); continue; case 9: if (tag !== 74) { break; } message.target_cpa_point_list = simulation_js_1.TargetCpaSimulationPointList.decode(reader, reader.uint32()); continue; case 11: if (tag !== 90) { break; } message.target_roas_point_list = simulation_js_1.TargetRoasSimulationPointList.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { resource_name: isSet(object.resource_name) ? globalThis.String(object.resource_name) : "", ad_group_id: isSet(object.ad_group_id) ? globalThis.String(object.ad_group_id) : undefined, type: isSet(object.type) ? (0, simulation_type_js_1.simulationTypeEnum_SimulationTypeFromJSON)(object.type) : 0, modification_method: isSet(object.modification_method) ? (0, simulation_modification_method_js_1.simulationModificationMethodEnum_SimulationModificationMethodFromJSON)(object.modification_method) : 0, start_date: isSet(object.start_date) ? globalThis.String(object.start_date) : undefined, end_date: isSet(object.end_date) ? globalThis.String(object.end_date) : undefined, cpc_bid_point_list: isSet(object.cpc_bid_point_list) ? simulation_js_1.CpcBidSimulationPointList.fromJSON(object.cpc_bid_point_list) : undefined, cpv_bid_point_list: isSet(object.cpv_bid_point_list) ? simulation_js_1.CpvBidSimulationPointList.fromJSON(object.cpv_bid_point_list) : undefined, target_cpa_point_list: isSet(object.target_cpa_point_list) ? simulation_js_1.TargetCpaSimulationPointList.fromJSON(object.target_cpa_point_list) : undefined, target_roas_point_list: isSet(object.target_roas_point_list) ? simulation_js_1.TargetRoasSimulationPointList.fromJSON(object.target_roas_point_list) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.ad_group_id !== undefined) { obj.ad_group_id = message.ad_group_id; } if (message.type !== undefined && message.type !== 0) { obj.type = (0, simulation_type_js_1.simulationTypeEnum_SimulationTypeToJSON)(message.type); } if (message.modification_method !== undefined && message.modification_method !== 0) { obj.modification_method = (0, simulation_modification_method_js_1.simulationModificationMethodEnum_SimulationModificationMethodToJSON)(message.modification_method); } if (message.start_date !== undefined) { obj.start_date = message.start_date; } if (message.end_date !== undefined) { obj.end_date = message.end_date; } if (message.cpc_bid_point_list !== undefined) { obj.cpc_bid_point_list = simulation_js_1.CpcBidSimulationPointList.toJSON(message.cpc_bid_point_list); } if (message.cpv_bid_point_list !== undefined) { obj.cpv_bid_point_list = simulation_js_1.CpvBidSimulationPointList.toJSON(message.cpv_bid_point_list); } if (message.target_cpa_point_list !== undefined) { obj.target_cpa_point_list = simulation_js_1.TargetCpaSimulationPointList.toJSON(message.target_cpa_point_list); } if (message.target_roas_point_list !== undefined) { obj.target_roas_point_list = simulation_js_1.TargetRoasSimulationPointList.toJSON(message.target_roas_point_list); } return obj; }, create(base) { return exports.AdGroupSimulation.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f; const message = createBaseAdGroupSimulation(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.ad_group_id = (_b = object.ad_group_id) !== null && _b !== void 0 ? _b : undefined; message.type = (_c = object.type) !== null && _c !== void 0 ? _c : 0; message.modification_method = (_d = object.modification_method) !== null && _d !== void 0 ? _d : 0; message.start_date = (_e = object.start_date) !== null && _e !== void 0 ? _e : undefined; message.end_date = (_f = object.end_date) !== null && _f !== void 0 ? _f : undefined; message.cpc_bid_point_list = (object.cpc_bid_point_list !== undefined && object.cpc_bid_point_list !== null) ? simulation_js_1.CpcBidSimulationPointList.fromPartial(object.cpc_bid_point_list) : undefined; message.cpv_bid_point_list = (object.cpv_bid_point_list !== undefined && object.cpv_bid_point_list !== null) ? simulation_js_1.CpvBidSimulationPointList.fromPartial(object.cpv_bid_point_list) : undefined; message.target_cpa_point_list = (object.target_cpa_point_list !== undefined && object.target_cpa_point_list !== null) ? simulation_js_1.TargetCpaSimulationPointList.fromPartial(object.target_cpa_point_list) : undefined; message.target_roas_point_list = (object.target_roas_point_list !== undefined && object.target_roas_point_list !== null) ? simulation_js_1.TargetRoasSimulationPointList.fromPartial(object.target_roas_point_list) : undefined; return message; }, }; function longToString(long) { return long.toString(); } if (minimal_js_1.default.util.Long !== long_1.default) { minimal_js_1.default.util.Long = long_1.default; minimal_js_1.default.configure(); } function isSet(value) { return value !== null && value !== undefined; }