@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
382 lines (381 loc) • 16.6 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/v21/resources/asset_set.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { BusinessProfileLocationGroup, ChainLocationGroup, LocationSet } from "../common/asset_set_types.js";
import { assetSetStatusEnum_AssetSetStatusFromJSON, assetSetStatusEnum_AssetSetStatusToJSON, } from "../enums/asset_set_status.js";
import { assetSetTypeEnum_AssetSetTypeFromJSON, assetSetTypeEnum_AssetSetTypeToJSON, } from "../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,
};
}
export const AssetSet = {
encode(message, writer = _m0.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) {
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) {
AssetSet_HotelPropertyData.encode(message.hotel_property_data, writer.uint32(90).fork()).ldelim();
}
if (message.location_set !== undefined) {
LocationSet.encode(message.location_set, writer.uint32(58).fork()).ldelim();
}
if (message.business_profile_location_group !== undefined) {
BusinessProfileLocationGroup.encode(message.business_profile_location_group, writer.uint32(66).fork()).ldelim();
}
if (message.chain_location_group !== undefined) {
ChainLocationGroup.encode(message.chain_location_group, writer.uint32(74).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 = 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 = 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 = AssetSet_HotelPropertyData.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
message.location_set = LocationSet.decode(reader, reader.uint32());
continue;
case 8:
if (tag !== 66) {
break;
}
message.business_profile_location_group = BusinessProfileLocationGroup.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 74) {
break;
}
message.chain_location_group = 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) ? assetSetTypeEnum_AssetSetTypeFromJSON(object.type) : 0,
status: isSet(object.status) ? assetSetStatusEnum_AssetSetStatusFromJSON(object.status) : 0,
merchant_center_feed: isSet(object.merchant_center_feed)
? 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)
? AssetSet_HotelPropertyData.fromJSON(object.hotel_property_data)
: undefined,
location_set: isSet(object.location_set) ? LocationSet.fromJSON(object.location_set) : undefined,
business_profile_location_group: isSet(object.business_profile_location_group)
? BusinessProfileLocationGroup.fromJSON(object.business_profile_location_group)
: undefined,
chain_location_group: isSet(object.chain_location_group)
? 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 = assetSetTypeEnum_AssetSetTypeToJSON(message.type);
}
if (message.status !== undefined && message.status !== 0) {
obj.status = assetSetStatusEnum_AssetSetStatusToJSON(message.status);
}
if (message.merchant_center_feed !== undefined) {
obj.merchant_center_feed = 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 = AssetSet_HotelPropertyData.toJSON(message.hotel_property_data);
}
if (message.location_set !== undefined) {
obj.location_set = LocationSet.toJSON(message.location_set);
}
if (message.business_profile_location_group !== undefined) {
obj.business_profile_location_group = BusinessProfileLocationGroup.toJSON(message.business_profile_location_group);
}
if (message.chain_location_group !== undefined) {
obj.chain_location_group = ChainLocationGroup.toJSON(message.chain_location_group);
}
return obj;
},
create(base) {
return 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)
? 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)
? AssetSet_HotelPropertyData.fromPartial(object.hotel_property_data)
: undefined;
message.location_set = (object.location_set !== undefined && object.location_set !== null)
? LocationSet.fromPartial(object.location_set)
: undefined;
message.business_profile_location_group =
(object.business_profile_location_group !== undefined && object.business_profile_location_group !== null)
? BusinessProfileLocationGroup.fromPartial(object.business_profile_location_group)
: undefined;
message.chain_location_group = (object.chain_location_group !== undefined && object.chain_location_group !== null)
? ChainLocationGroup.fromPartial(object.chain_location_group)
: undefined;
return message;
},
};
function createBaseAssetSet_MerchantCenterFeed() {
return { merchant_id: "0", feed_label: undefined };
}
export const AssetSet_MerchantCenterFeed = {
encode(message, writer = _m0.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 _m0.Reader ? input : _m0.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 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 };
}
export const AssetSet_HotelPropertyData = {
encode(message, writer = _m0.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 _m0.Reader ? input : _m0.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 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 (_m0.util.Long !== Long) {
_m0.util.Long = Long;
_m0.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}