UNPKG

@htdangkhoa/google-ads

Version:
165 lines (164 loc) 7.32 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/v24/resources/goal.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Goal = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_js_1 = __importDefault(require("protobufjs/minimal.js")); const goal_setting_js_1 = require("../common/goal_setting.js"); const goal_optimization_eligibility_js_1 = require("../enums/goal_optimization_eligibility.js"); const goal_type_js_1 = require("../enums/goal_type.js"); function createBaseGoal() { return { resource_name: "", goal_id: undefined, goal_type: 0, owner_customer: undefined, optimization_eligibility: 0, retention_goal_settings: undefined, }; } exports.Goal = { 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.goal_id !== undefined) { writer.uint32(16).int64(message.goal_id); } if (message.goal_type !== undefined && message.goal_type !== 0) { writer.uint32(24).int32(message.goal_type); } if (message.owner_customer !== undefined) { writer.uint32(34).string(message.owner_customer); } if (message.optimization_eligibility !== undefined && message.optimization_eligibility !== 0) { writer.uint32(48).int32(message.optimization_eligibility); } if (message.retention_goal_settings !== undefined) { goal_setting_js_1.GoalSetting_RetentionGoal.encode(message.retention_goal_settings, writer.uint32(58).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 = createBaseGoal(); 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.goal_id = longToString(reader.int64()); continue; case 3: if (tag !== 24) { break; } message.goal_type = reader.int32(); continue; case 4: if (tag !== 34) { break; } message.owner_customer = reader.string(); continue; case 6: if (tag !== 48) { break; } message.optimization_eligibility = reader.int32(); continue; case 7: if (tag !== 58) { break; } message.retention_goal_settings = goal_setting_js_1.GoalSetting_RetentionGoal.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) : "", goal_id: isSet(object.goal_id) ? globalThis.String(object.goal_id) : undefined, goal_type: isSet(object.goal_type) ? (0, goal_type_js_1.goalTypeEnum_GoalTypeFromJSON)(object.goal_type) : 0, owner_customer: isSet(object.owner_customer) ? globalThis.String(object.owner_customer) : undefined, optimization_eligibility: isSet(object.optimization_eligibility) ? (0, goal_optimization_eligibility_js_1.goalOptimizationEligibilityEnum_GoalOptimizationEligibilityFromJSON)(object.optimization_eligibility) : 0, retention_goal_settings: isSet(object.retention_goal_settings) ? goal_setting_js_1.GoalSetting_RetentionGoal.fromJSON(object.retention_goal_settings) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.goal_id !== undefined) { obj.goal_id = message.goal_id; } if (message.goal_type !== undefined && message.goal_type !== 0) { obj.goal_type = (0, goal_type_js_1.goalTypeEnum_GoalTypeToJSON)(message.goal_type); } if (message.owner_customer !== undefined) { obj.owner_customer = message.owner_customer; } if (message.optimization_eligibility !== undefined && message.optimization_eligibility !== 0) { obj.optimization_eligibility = (0, goal_optimization_eligibility_js_1.goalOptimizationEligibilityEnum_GoalOptimizationEligibilityToJSON)(message.optimization_eligibility); } if (message.retention_goal_settings !== undefined) { obj.retention_goal_settings = goal_setting_js_1.GoalSetting_RetentionGoal.toJSON(message.retention_goal_settings); } return obj; }, create(base) { return exports.Goal.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseGoal(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.goal_id = (_b = object.goal_id) !== null && _b !== void 0 ? _b : undefined; message.goal_type = (_c = object.goal_type) !== null && _c !== void 0 ? _c : 0; message.owner_customer = (_d = object.owner_customer) !== null && _d !== void 0 ? _d : undefined; message.optimization_eligibility = (_e = object.optimization_eligibility) !== null && _e !== void 0 ? _e : 0; message.retention_goal_settings = (object.retention_goal_settings !== undefined && object.retention_goal_settings !== null) ? goal_setting_js_1.GoalSetting_RetentionGoal.fromPartial(object.retention_goal_settings) : 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; }