UNPKG

@htdangkhoa/google-ads

Version:
232 lines (231 loc) 10.7 kB
// 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/v20/resources/ad_group_simulation.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; import { CpcBidSimulationPointList, CpvBidSimulationPointList, TargetCpaSimulationPointList, TargetRoasSimulationPointList, } from "../common/simulation.js"; import { simulationModificationMethodEnum_SimulationModificationMethodFromJSON, simulationModificationMethodEnum_SimulationModificationMethodToJSON, } from "../enums/simulation_modification_method.js"; import { simulationTypeEnum_SimulationTypeFromJSON, simulationTypeEnum_SimulationTypeToJSON, } from "../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, }; } export const AdGroupSimulation = { encode(message, writer = _m0.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) { CpcBidSimulationPointList.encode(message.cpc_bid_point_list, writer.uint32(66).fork()).ldelim(); } if (message.cpv_bid_point_list !== undefined) { CpvBidSimulationPointList.encode(message.cpv_bid_point_list, writer.uint32(82).fork()).ldelim(); } if (message.target_cpa_point_list !== undefined) { TargetCpaSimulationPointList.encode(message.target_cpa_point_list, writer.uint32(74).fork()).ldelim(); } if (message.target_roas_point_list !== undefined) { TargetRoasSimulationPointList.encode(message.target_roas_point_list, writer.uint32(90).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.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 = CpcBidSimulationPointList.decode(reader, reader.uint32()); continue; case 10: if (tag !== 82) { break; } message.cpv_bid_point_list = CpvBidSimulationPointList.decode(reader, reader.uint32()); continue; case 9: if (tag !== 74) { break; } message.target_cpa_point_list = TargetCpaSimulationPointList.decode(reader, reader.uint32()); continue; case 11: if (tag !== 90) { break; } message.target_roas_point_list = 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) ? simulationTypeEnum_SimulationTypeFromJSON(object.type) : 0, modification_method: isSet(object.modification_method) ? 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) ? CpcBidSimulationPointList.fromJSON(object.cpc_bid_point_list) : undefined, cpv_bid_point_list: isSet(object.cpv_bid_point_list) ? CpvBidSimulationPointList.fromJSON(object.cpv_bid_point_list) : undefined, target_cpa_point_list: isSet(object.target_cpa_point_list) ? TargetCpaSimulationPointList.fromJSON(object.target_cpa_point_list) : undefined, target_roas_point_list: isSet(object.target_roas_point_list) ? 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 = simulationTypeEnum_SimulationTypeToJSON(message.type); } if (message.modification_method !== undefined && message.modification_method !== 0) { obj.modification_method = 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 = CpcBidSimulationPointList.toJSON(message.cpc_bid_point_list); } if (message.cpv_bid_point_list !== undefined) { obj.cpv_bid_point_list = CpvBidSimulationPointList.toJSON(message.cpv_bid_point_list); } if (message.target_cpa_point_list !== undefined) { obj.target_cpa_point_list = TargetCpaSimulationPointList.toJSON(message.target_cpa_point_list); } if (message.target_roas_point_list !== undefined) { obj.target_roas_point_list = TargetRoasSimulationPointList.toJSON(message.target_roas_point_list); } return obj; }, create(base) { return 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) ? 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) ? 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) ? 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) ? TargetRoasSimulationPointList.fromPartial(object.target_roas_point_list) : undefined; return message; }, }; function longToString(long) { return long.toString(); } if (_m0.util.Long !== Long) { _m0.util.Long = Long; _m0.configure(); } function isSet(value) { return value !== null && value !== undefined; }