@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
388 lines (387 loc) • 17.5 kB
JavaScript
;
// 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/asset_set.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AssetSet_HotelPropertyData = exports.AssetSet_MerchantCenterFeed = exports.AssetSet = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const asset_set_types_js_1 = require("../common/asset_set_types.js");
const asset_set_status_js_1 = require("../enums/asset_set_status.js");
const asset_set_type_js_1 = require("../enums/asset_set_type.js");
function createBaseAssetSet() {
return {
id: "0",
resource_name: "",
name: "",
type: 0,
status: 0,
merchant_center_feed: undefined,
location_group_parent_asset_set_id: "0",
hotel_property_data: undefined,
location_set: undefined,
business_profile_location_group: undefined,
chain_location_group: undefined,
};
}
exports.AssetSet = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.id !== undefined && message.id !== "0") {
writer.uint32(48).int64(message.id);
}
if (message.resource_name !== undefined && message.resource_name !== "") {
writer.uint32(10).string(message.resource_name);
}
if (message.name !== undefined && message.name !== "") {
writer.uint32(18).string(message.name);
}
if (message.type !== undefined && message.type !== 0) {
writer.uint32(24).int32(message.type);
}
if (message.status !== undefined && message.status !== 0) {
writer.uint32(32).int32(message.status);
}
if (message.merchant_center_feed !== undefined) {
exports.AssetSet_MerchantCenterFeed.encode(message.merchant_center_feed, writer.uint32(42).fork()).ldelim();
}
if (message.location_group_parent_asset_set_id !== undefined && message.location_group_parent_asset_set_id !== "0") {
writer.uint32(80).int64(message.location_group_parent_asset_set_id);
}
if (message.hotel_property_data !== undefined) {
exports.AssetSet_HotelPropertyData.encode(message.hotel_property_data, writer.uint32(90).fork()).ldelim();
}
if (message.location_set !== undefined) {
asset_set_types_js_1.LocationSet.encode(message.location_set, writer.uint32(58).fork()).ldelim();
}
if (message.business_profile_location_group !== undefined) {
asset_set_types_js_1.BusinessProfileLocationGroup.encode(message.business_profile_location_group, writer.uint32(66).fork()).ldelim();
}
if (message.chain_location_group !== undefined) {
asset_set_types_js_1.ChainLocationGroup.encode(message.chain_location_group, writer.uint32(74).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 = createBaseAssetSet();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 6:
if (tag !== 48) {
break;
}
message.id = longToString(reader.int64());
continue;
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.name = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.type = reader.int32();
continue;
case 4:
if (tag !== 32) {
break;
}
message.status = reader.int32();
continue;
case 5:
if (tag !== 42) {
break;
}
message.merchant_center_feed = exports.AssetSet_MerchantCenterFeed.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 80) {
break;
}
message.location_group_parent_asset_set_id = longToString(reader.int64());
continue;
case 11:
if (tag !== 90) {
break;
}
message.hotel_property_data = exports.AssetSet_HotelPropertyData.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
message.location_set = asset_set_types_js_1.LocationSet.decode(reader, reader.uint32());
continue;
case 8:
if (tag !== 66) {
break;
}
message.business_profile_location_group = asset_set_types_js_1.BusinessProfileLocationGroup.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 74) {
break;
}
message.chain_location_group = asset_set_types_js_1.ChainLocationGroup.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "0",
resource_name: isSet(object.resource_name) ? globalThis.String(object.resource_name) : "",
name: isSet(object.name) ? globalThis.String(object.name) : "",
type: isSet(object.type) ? (0, asset_set_type_js_1.assetSetTypeEnum_AssetSetTypeFromJSON)(object.type) : 0,
status: isSet(object.status) ? (0, asset_set_status_js_1.assetSetStatusEnum_AssetSetStatusFromJSON)(object.status) : 0,
merchant_center_feed: isSet(object.merchant_center_feed)
? exports.AssetSet_MerchantCenterFeed.fromJSON(object.merchant_center_feed)
: undefined,
location_group_parent_asset_set_id: isSet(object.location_group_parent_asset_set_id)
? globalThis.String(object.location_group_parent_asset_set_id)
: "0",
hotel_property_data: isSet(object.hotel_property_data)
? exports.AssetSet_HotelPropertyData.fromJSON(object.hotel_property_data)
: undefined,
location_set: isSet(object.location_set) ? asset_set_types_js_1.LocationSet.fromJSON(object.location_set) : undefined,
business_profile_location_group: isSet(object.business_profile_location_group)
? asset_set_types_js_1.BusinessProfileLocationGroup.fromJSON(object.business_profile_location_group)
: undefined,
chain_location_group: isSet(object.chain_location_group)
? asset_set_types_js_1.ChainLocationGroup.fromJSON(object.chain_location_group)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== undefined && message.id !== "0") {
obj.id = message.id;
}
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.name !== undefined && message.name !== "") {
obj.name = message.name;
}
if (message.type !== undefined && message.type !== 0) {
obj.type = (0, asset_set_type_js_1.assetSetTypeEnum_AssetSetTypeToJSON)(message.type);
}
if (message.status !== undefined && message.status !== 0) {
obj.status = (0, asset_set_status_js_1.assetSetStatusEnum_AssetSetStatusToJSON)(message.status);
}
if (message.merchant_center_feed !== undefined) {
obj.merchant_center_feed = exports.AssetSet_MerchantCenterFeed.toJSON(message.merchant_center_feed);
}
if (message.location_group_parent_asset_set_id !== undefined && message.location_group_parent_asset_set_id !== "0") {
obj.location_group_parent_asset_set_id = message.location_group_parent_asset_set_id;
}
if (message.hotel_property_data !== undefined) {
obj.hotel_property_data = exports.AssetSet_HotelPropertyData.toJSON(message.hotel_property_data);
}
if (message.location_set !== undefined) {
obj.location_set = asset_set_types_js_1.LocationSet.toJSON(message.location_set);
}
if (message.business_profile_location_group !== undefined) {
obj.business_profile_location_group = asset_set_types_js_1.BusinessProfileLocationGroup.toJSON(message.business_profile_location_group);
}
if (message.chain_location_group !== undefined) {
obj.chain_location_group = asset_set_types_js_1.ChainLocationGroup.toJSON(message.chain_location_group);
}
return obj;
},
create(base) {
return exports.AssetSet.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f;
const message = createBaseAssetSet();
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "0";
message.resource_name = (_b = object.resource_name) !== null && _b !== void 0 ? _b : "";
message.name = (_c = object.name) !== null && _c !== void 0 ? _c : "";
message.type = (_d = object.type) !== null && _d !== void 0 ? _d : 0;
message.status = (_e = object.status) !== null && _e !== void 0 ? _e : 0;
message.merchant_center_feed = (object.merchant_center_feed !== undefined && object.merchant_center_feed !== null)
? exports.AssetSet_MerchantCenterFeed.fromPartial(object.merchant_center_feed)
: undefined;
message.location_group_parent_asset_set_id = (_f = object.location_group_parent_asset_set_id) !== null && _f !== void 0 ? _f : "0";
message.hotel_property_data = (object.hotel_property_data !== undefined && object.hotel_property_data !== null)
? exports.AssetSet_HotelPropertyData.fromPartial(object.hotel_property_data)
: undefined;
message.location_set = (object.location_set !== undefined && object.location_set !== null)
? asset_set_types_js_1.LocationSet.fromPartial(object.location_set)
: undefined;
message.business_profile_location_group =
(object.business_profile_location_group !== undefined && object.business_profile_location_group !== null)
? asset_set_types_js_1.BusinessProfileLocationGroup.fromPartial(object.business_profile_location_group)
: undefined;
message.chain_location_group = (object.chain_location_group !== undefined && object.chain_location_group !== null)
? asset_set_types_js_1.ChainLocationGroup.fromPartial(object.chain_location_group)
: undefined;
return message;
},
};
function createBaseAssetSet_MerchantCenterFeed() {
return { merchant_id: "0", feed_label: undefined };
}
exports.AssetSet_MerchantCenterFeed = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.merchant_id !== undefined && message.merchant_id !== "0") {
writer.uint32(8).int64(message.merchant_id);
}
if (message.feed_label !== undefined) {
writer.uint32(18).string(message.feed_label);
}
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 = createBaseAssetSet_MerchantCenterFeed();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.merchant_id = longToString(reader.int64());
continue;
case 2:
if (tag !== 18) {
break;
}
message.feed_label = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
merchant_id: isSet(object.merchant_id) ? globalThis.String(object.merchant_id) : "0",
feed_label: isSet(object.feed_label) ? globalThis.String(object.feed_label) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.merchant_id !== undefined && message.merchant_id !== "0") {
obj.merchant_id = message.merchant_id;
}
if (message.feed_label !== undefined) {
obj.feed_label = message.feed_label;
}
return obj;
},
create(base) {
return exports.AssetSet_MerchantCenterFeed.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseAssetSet_MerchantCenterFeed();
message.merchant_id = (_a = object.merchant_id) !== null && _a !== void 0 ? _a : "0";
message.feed_label = (_b = object.feed_label) !== null && _b !== void 0 ? _b : undefined;
return message;
},
};
function createBaseAssetSet_HotelPropertyData() {
return { hotel_center_id: undefined, partner_name: undefined };
}
exports.AssetSet_HotelPropertyData = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.hotel_center_id !== undefined) {
writer.uint32(8).int64(message.hotel_center_id);
}
if (message.partner_name !== undefined) {
writer.uint32(18).string(message.partner_name);
}
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 = createBaseAssetSet_HotelPropertyData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.hotel_center_id = longToString(reader.int64());
continue;
case 2:
if (tag !== 18) {
break;
}
message.partner_name = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
hotel_center_id: isSet(object.hotel_center_id) ? globalThis.String(object.hotel_center_id) : undefined,
partner_name: isSet(object.partner_name) ? globalThis.String(object.partner_name) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.hotel_center_id !== undefined) {
obj.hotel_center_id = message.hotel_center_id;
}
if (message.partner_name !== undefined) {
obj.partner_name = message.partner_name;
}
return obj;
},
create(base) {
return exports.AssetSet_HotelPropertyData.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseAssetSet_HotelPropertyData();
message.hotel_center_id = (_a = object.hotel_center_id) !== null && _a !== void 0 ? _a : undefined;
message.partner_name = (_b = object.partner_name) !== null && _b !== void 0 ? _b : 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;
}