@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
209 lines (208 loc) • 9.89 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/v19/resources/call_view.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallView = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const call_tracking_display_location_js_1 = require("../enums/call_tracking_display_location.js");
const call_type_js_1 = require("../enums/call_type.js");
const google_voice_call_status_js_1 = require("../enums/google_voice_call_status.js");
function createBaseCallView() {
return {
resource_name: "",
caller_country_code: "",
caller_area_code: "",
call_duration_seconds: "0",
start_call_date_time: "",
end_call_date_time: "",
call_tracking_display_location: 0,
type: 0,
call_status: 0,
};
}
exports.CallView = {
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.caller_country_code !== undefined && message.caller_country_code !== "") {
writer.uint32(18).string(message.caller_country_code);
}
if (message.caller_area_code !== undefined && message.caller_area_code !== "") {
writer.uint32(26).string(message.caller_area_code);
}
if (message.call_duration_seconds !== undefined && message.call_duration_seconds !== "0") {
writer.uint32(32).int64(message.call_duration_seconds);
}
if (message.start_call_date_time !== undefined && message.start_call_date_time !== "") {
writer.uint32(42).string(message.start_call_date_time);
}
if (message.end_call_date_time !== undefined && message.end_call_date_time !== "") {
writer.uint32(50).string(message.end_call_date_time);
}
if (message.call_tracking_display_location !== undefined && message.call_tracking_display_location !== 0) {
writer.uint32(56).int32(message.call_tracking_display_location);
}
if (message.type !== undefined && message.type !== 0) {
writer.uint32(64).int32(message.type);
}
if (message.call_status !== undefined && message.call_status !== 0) {
writer.uint32(72).int32(message.call_status);
}
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 = createBaseCallView();
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.caller_country_code = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.caller_area_code = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.call_duration_seconds = longToString(reader.int64());
continue;
case 5:
if (tag !== 42) {
break;
}
message.start_call_date_time = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.end_call_date_time = reader.string();
continue;
case 7:
if (tag !== 56) {
break;
}
message.call_tracking_display_location = reader.int32();
continue;
case 8:
if (tag !== 64) {
break;
}
message.type = reader.int32();
continue;
case 9:
if (tag !== 72) {
break;
}
message.call_status = reader.int32();
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) : "",
caller_country_code: isSet(object.caller_country_code) ? globalThis.String(object.caller_country_code) : "",
caller_area_code: isSet(object.caller_area_code) ? globalThis.String(object.caller_area_code) : "",
call_duration_seconds: isSet(object.call_duration_seconds)
? globalThis.String(object.call_duration_seconds)
: "0",
start_call_date_time: isSet(object.start_call_date_time) ? globalThis.String(object.start_call_date_time) : "",
end_call_date_time: isSet(object.end_call_date_time) ? globalThis.String(object.end_call_date_time) : "",
call_tracking_display_location: isSet(object.call_tracking_display_location)
? (0, call_tracking_display_location_js_1.callTrackingDisplayLocationEnum_CallTrackingDisplayLocationFromJSON)(object.call_tracking_display_location)
: 0,
type: isSet(object.type) ? (0, call_type_js_1.callTypeEnum_CallTypeFromJSON)(object.type) : 0,
call_status: isSet(object.call_status)
? (0, google_voice_call_status_js_1.googleVoiceCallStatusEnum_GoogleVoiceCallStatusFromJSON)(object.call_status)
: 0,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.caller_country_code !== undefined && message.caller_country_code !== "") {
obj.caller_country_code = message.caller_country_code;
}
if (message.caller_area_code !== undefined && message.caller_area_code !== "") {
obj.caller_area_code = message.caller_area_code;
}
if (message.call_duration_seconds !== undefined && message.call_duration_seconds !== "0") {
obj.call_duration_seconds = message.call_duration_seconds;
}
if (message.start_call_date_time !== undefined && message.start_call_date_time !== "") {
obj.start_call_date_time = message.start_call_date_time;
}
if (message.end_call_date_time !== undefined && message.end_call_date_time !== "") {
obj.end_call_date_time = message.end_call_date_time;
}
if (message.call_tracking_display_location !== undefined && message.call_tracking_display_location !== 0) {
obj.call_tracking_display_location = (0, call_tracking_display_location_js_1.callTrackingDisplayLocationEnum_CallTrackingDisplayLocationToJSON)(message.call_tracking_display_location);
}
if (message.type !== undefined && message.type !== 0) {
obj.type = (0, call_type_js_1.callTypeEnum_CallTypeToJSON)(message.type);
}
if (message.call_status !== undefined && message.call_status !== 0) {
obj.call_status = (0, google_voice_call_status_js_1.googleVoiceCallStatusEnum_GoogleVoiceCallStatusToJSON)(message.call_status);
}
return obj;
},
create(base) {
return exports.CallView.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const message = createBaseCallView();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.caller_country_code = (_b = object.caller_country_code) !== null && _b !== void 0 ? _b : "";
message.caller_area_code = (_c = object.caller_area_code) !== null && _c !== void 0 ? _c : "";
message.call_duration_seconds = (_d = object.call_duration_seconds) !== null && _d !== void 0 ? _d : "0";
message.start_call_date_time = (_e = object.start_call_date_time) !== null && _e !== void 0 ? _e : "";
message.end_call_date_time = (_f = object.end_call_date_time) !== null && _f !== void 0 ? _f : "";
message.call_tracking_display_location = (_g = object.call_tracking_display_location) !== null && _g !== void 0 ? _g : 0;
message.type = (_h = object.type) !== null && _h !== void 0 ? _h : 0;
message.call_status = (_j = object.call_status) !== null && _j !== void 0 ? _j : 0;
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;
}