UNPKG

@htdangkhoa/google-ads

Version:
200 lines (199 loc) 9.42 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/v21/resources/bidding_strategy_simulation.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BiddingStrategySimulation = 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 createBaseBiddingStrategySimulation() { return { resource_name: "", bidding_strategy_id: "0", type: 0, modification_method: 0, start_date: "", end_date: "", target_cpa_point_list: undefined, target_roas_point_list: undefined, }; } exports.BiddingStrategySimulation = { 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.bidding_strategy_id !== undefined && message.bidding_strategy_id !== "0") { writer.uint32(16).int64(message.bidding_strategy_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 && message.start_date !== "") { writer.uint32(42).string(message.start_date); } if (message.end_date !== undefined && message.end_date !== "") { writer.uint32(50).string(message.end_date); } if (message.target_cpa_point_list !== undefined) { simulation_js_1.TargetCpaSimulationPointList.encode(message.target_cpa_point_list, writer.uint32(58).fork()).ldelim(); } if (message.target_roas_point_list !== undefined) { simulation_js_1.TargetRoasSimulationPointList.encode(message.target_roas_point_list, 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 = createBaseBiddingStrategySimulation(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 2: if (tag !== 16) { break; } message.bidding_strategy_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 5: if (tag !== 42) { break; } message.start_date = reader.string(); continue; case 6: if (tag !== 50) { break; } message.end_date = reader.string(); continue; case 7: if (tag !== 58) { break; } message.target_cpa_point_list = simulation_js_1.TargetCpaSimulationPointList.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { 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) : "", bidding_strategy_id: isSet(object.bidding_strategy_id) ? globalThis.String(object.bidding_strategy_id) : "0", 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) : "", end_date: isSet(object.end_date) ? globalThis.String(object.end_date) : "", 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.bidding_strategy_id !== undefined && message.bidding_strategy_id !== "0") { obj.bidding_strategy_id = message.bidding_strategy_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 && message.start_date !== "") { obj.start_date = message.start_date; } if (message.end_date !== undefined && message.end_date !== "") { obj.end_date = message.end_date; } 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.BiddingStrategySimulation.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f; const message = createBaseBiddingStrategySimulation(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.bidding_strategy_id = (_b = object.bidding_strategy_id) !== null && _b !== void 0 ? _b : "0"; 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 : ""; message.end_date = (_f = object.end_date) !== null && _f !== void 0 ? _f : ""; 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; }