UNPKG

@htdangkhoa/google-ads

Version:
198 lines (197 loc) 9.52 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/v21/resources/customer_asset.proto /* eslint-disable */ import _m0 from "protobufjs/minimal.js"; import { AssetLinkPrimaryStatusDetails } from "../common/asset_policy.js"; import { assetFieldTypeEnum_AssetFieldTypeFromJSON, assetFieldTypeEnum_AssetFieldTypeToJSON, } from "../enums/asset_field_type.js"; import { assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusFromJSON, assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusToJSON, } from "../enums/asset_link_primary_status.js"; import { assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonFromJSON, assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonToJSON, } from "../enums/asset_link_primary_status_reason.js"; import { assetLinkStatusEnum_AssetLinkStatusFromJSON, assetLinkStatusEnum_AssetLinkStatusToJSON, } from "../enums/asset_link_status.js"; import { assetSourceEnum_AssetSourceFromJSON, assetSourceEnum_AssetSourceToJSON, } from "../enums/asset_source.js"; function createBaseCustomerAsset() { return { resource_name: "", asset: "", field_type: 0, source: 0, status: 0, primary_status: 0, primary_status_details: [], primary_status_reasons: [], }; } export const CustomerAsset = { encode(message, writer = _m0.Writer.create()) { if (message.resource_name !== undefined && message.resource_name !== "") { writer.uint32(10).string(message.resource_name); } if (message.asset !== undefined && message.asset !== "") { writer.uint32(18).string(message.asset); } if (message.field_type !== undefined && message.field_type !== 0) { writer.uint32(24).int32(message.field_type); } if (message.source !== undefined && message.source !== 0) { writer.uint32(40).int32(message.source); } if (message.status !== undefined && message.status !== 0) { writer.uint32(32).int32(message.status); } if (message.primary_status !== undefined && message.primary_status !== 0) { writer.uint32(48).int32(message.primary_status); } if (message.primary_status_details !== undefined && message.primary_status_details.length !== 0) { for (const v of message.primary_status_details) { AssetLinkPrimaryStatusDetails.encode(v, writer.uint32(58).fork()).ldelim(); } } if (message.primary_status_reasons !== undefined && message.primary_status_reasons.length !== 0) { writer.uint32(66).fork(); for (const v of message.primary_status_reasons) { writer.int32(v); } writer.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 = createBaseCustomerAsset(); 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 !== 18) { break; } message.asset = reader.string(); continue; case 3: if (tag !== 24) { break; } message.field_type = reader.int32(); continue; case 5: if (tag !== 40) { break; } message.source = reader.int32(); continue; case 4: if (tag !== 32) { break; } message.status = reader.int32(); continue; case 6: if (tag !== 48) { break; } message.primary_status = reader.int32(); continue; case 7: if (tag !== 58) { break; } message.primary_status_details.push(AssetLinkPrimaryStatusDetails.decode(reader, reader.uint32())); continue; case 8: if (tag === 64) { message.primary_status_reasons.push(reader.int32()); continue; } if (tag === 66) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.primary_status_reasons.push(reader.int32()); } continue; } break; } 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) : "", asset: isSet(object.asset) ? globalThis.String(object.asset) : "", field_type: isSet(object.field_type) ? assetFieldTypeEnum_AssetFieldTypeFromJSON(object.field_type) : 0, source: isSet(object.source) ? assetSourceEnum_AssetSourceFromJSON(object.source) : 0, status: isSet(object.status) ? assetLinkStatusEnum_AssetLinkStatusFromJSON(object.status) : 0, primary_status: isSet(object.primary_status) ? assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusFromJSON(object.primary_status) : 0, primary_status_details: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.primary_status_details) ? object.primary_status_details.map((e) => AssetLinkPrimaryStatusDetails.fromJSON(e)) : [], primary_status_reasons: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.primary_status_reasons) ? object.primary_status_reasons.map((e) => assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonFromJSON(e)) : [], }; }, toJSON(message) { var _a, _b; const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.asset !== undefined && message.asset !== "") { obj.asset = message.asset; } if (message.field_type !== undefined && message.field_type !== 0) { obj.field_type = assetFieldTypeEnum_AssetFieldTypeToJSON(message.field_type); } if (message.source !== undefined && message.source !== 0) { obj.source = assetSourceEnum_AssetSourceToJSON(message.source); } if (message.status !== undefined && message.status !== 0) { obj.status = assetLinkStatusEnum_AssetLinkStatusToJSON(message.status); } if (message.primary_status !== undefined && message.primary_status !== 0) { obj.primary_status = assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusToJSON(message.primary_status); } if ((_a = message.primary_status_details) === null || _a === void 0 ? void 0 : _a.length) { obj.primary_status_details = message.primary_status_details.map((e) => AssetLinkPrimaryStatusDetails.toJSON(e)); } if ((_b = message.primary_status_reasons) === null || _b === void 0 ? void 0 : _b.length) { obj.primary_status_reasons = message.primary_status_reasons.map((e) => assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonToJSON(e)); } return obj; }, create(base) { return CustomerAsset.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h; const message = createBaseCustomerAsset(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.asset = (_b = object.asset) !== null && _b !== void 0 ? _b : ""; message.field_type = (_c = object.field_type) !== null && _c !== void 0 ? _c : 0; message.source = (_d = object.source) !== null && _d !== void 0 ? _d : 0; message.status = (_e = object.status) !== null && _e !== void 0 ? _e : 0; message.primary_status = (_f = object.primary_status) !== null && _f !== void 0 ? _f : 0; message.primary_status_details = ((_g = object.primary_status_details) === null || _g === void 0 ? void 0 : _g.map((e) => AssetLinkPrimaryStatusDetails.fromPartial(e))) || []; message.primary_status_reasons = ((_h = object.primary_status_reasons) === null || _h === void 0 ? void 0 : _h.map((e) => e)) || []; return message; }, }; function isSet(value) { return value !== null && value !== undefined; }