@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
227 lines (226 loc) • 9.98 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/click_view.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClickView = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const click_location_js_1 = require("../common/click_location.js");
const criteria_js_1 = require("../common/criteria.js");
function createBaseClickView() {
return {
resource_name: "",
gclid: undefined,
area_of_interest: undefined,
location_of_presence: undefined,
page_number: undefined,
ad_group_ad: undefined,
campaign_location_target: undefined,
user_list: undefined,
keyword: "",
keyword_info: undefined,
};
}
exports.ClickView = {
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.gclid !== undefined) {
writer.uint32(66).string(message.gclid);
}
if (message.area_of_interest !== undefined) {
click_location_js_1.ClickLocation.encode(message.area_of_interest, writer.uint32(26).fork()).ldelim();
}
if (message.location_of_presence !== undefined) {
click_location_js_1.ClickLocation.encode(message.location_of_presence, writer.uint32(34).fork()).ldelim();
}
if (message.page_number !== undefined) {
writer.uint32(72).int64(message.page_number);
}
if (message.ad_group_ad !== undefined) {
writer.uint32(82).string(message.ad_group_ad);
}
if (message.campaign_location_target !== undefined) {
writer.uint32(90).string(message.campaign_location_target);
}
if (message.user_list !== undefined) {
writer.uint32(98).string(message.user_list);
}
if (message.keyword !== undefined && message.keyword !== "") {
writer.uint32(106).string(message.keyword);
}
if (message.keyword_info !== undefined) {
criteria_js_1.KeywordInfo.encode(message.keyword_info, writer.uint32(114).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 = createBaseClickView();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.gclid = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.area_of_interest = click_location_js_1.ClickLocation.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.location_of_presence = click_location_js_1.ClickLocation.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 72) {
break;
}
message.page_number = longToString(reader.int64());
continue;
case 10:
if (tag !== 82) {
break;
}
message.ad_group_ad = reader.string();
continue;
case 11:
if (tag !== 90) {
break;
}
message.campaign_location_target = reader.string();
continue;
case 12:
if (tag !== 98) {
break;
}
message.user_list = reader.string();
continue;
case 13:
if (tag !== 106) {
break;
}
message.keyword = reader.string();
continue;
case 14:
if (tag !== 114) {
break;
}
message.keyword_info = criteria_js_1.KeywordInfo.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) : "",
gclid: isSet(object.gclid) ? globalThis.String(object.gclid) : undefined,
area_of_interest: isSet(object.area_of_interest) ? click_location_js_1.ClickLocation.fromJSON(object.area_of_interest) : undefined,
location_of_presence: isSet(object.location_of_presence)
? click_location_js_1.ClickLocation.fromJSON(object.location_of_presence)
: undefined,
page_number: isSet(object.page_number) ? globalThis.String(object.page_number) : undefined,
ad_group_ad: isSet(object.ad_group_ad) ? globalThis.String(object.ad_group_ad) : undefined,
campaign_location_target: isSet(object.campaign_location_target)
? globalThis.String(object.campaign_location_target)
: undefined,
user_list: isSet(object.user_list) ? globalThis.String(object.user_list) : undefined,
keyword: isSet(object.keyword) ? globalThis.String(object.keyword) : "",
keyword_info: isSet(object.keyword_info) ? criteria_js_1.KeywordInfo.fromJSON(object.keyword_info) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.gclid !== undefined) {
obj.gclid = message.gclid;
}
if (message.area_of_interest !== undefined) {
obj.area_of_interest = click_location_js_1.ClickLocation.toJSON(message.area_of_interest);
}
if (message.location_of_presence !== undefined) {
obj.location_of_presence = click_location_js_1.ClickLocation.toJSON(message.location_of_presence);
}
if (message.page_number !== undefined) {
obj.page_number = message.page_number;
}
if (message.ad_group_ad !== undefined) {
obj.ad_group_ad = message.ad_group_ad;
}
if (message.campaign_location_target !== undefined) {
obj.campaign_location_target = message.campaign_location_target;
}
if (message.user_list !== undefined) {
obj.user_list = message.user_list;
}
if (message.keyword !== undefined && message.keyword !== "") {
obj.keyword = message.keyword;
}
if (message.keyword_info !== undefined) {
obj.keyword_info = criteria_js_1.KeywordInfo.toJSON(message.keyword_info);
}
return obj;
},
create(base) {
return exports.ClickView.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = createBaseClickView();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.gclid = (_b = object.gclid) !== null && _b !== void 0 ? _b : undefined;
message.area_of_interest = (object.area_of_interest !== undefined && object.area_of_interest !== null)
? click_location_js_1.ClickLocation.fromPartial(object.area_of_interest)
: undefined;
message.location_of_presence = (object.location_of_presence !== undefined && object.location_of_presence !== null)
? click_location_js_1.ClickLocation.fromPartial(object.location_of_presence)
: undefined;
message.page_number = (_c = object.page_number) !== null && _c !== void 0 ? _c : undefined;
message.ad_group_ad = (_d = object.ad_group_ad) !== null && _d !== void 0 ? _d : undefined;
message.campaign_location_target = (_e = object.campaign_location_target) !== null && _e !== void 0 ? _e : undefined;
message.user_list = (_f = object.user_list) !== null && _f !== void 0 ? _f : undefined;
message.keyword = (_g = object.keyword) !== null && _g !== void 0 ? _g : "";
message.keyword_info = (object.keyword_info !== undefined && object.keyword_info !== null)
? criteria_js_1.KeywordInfo.fromPartial(object.keyword_info)
: 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;
}