@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
130 lines (129 loc) • 5.79 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/recommendation_subscription.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RecommendationSubscription = void 0;
/* eslint-disable */
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const recommendation_subscription_status_js_1 = require("../enums/recommendation_subscription_status.js");
const recommendation_type_js_1 = require("../enums/recommendation_type.js");
function createBaseRecommendationSubscription() {
return { resource_name: "", type: 0, create_date_time: undefined, modify_date_time: undefined, status: undefined };
}
exports.RecommendationSubscription = {
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.type !== undefined && message.type !== 0) {
writer.uint32(16).int32(message.type);
}
if (message.create_date_time !== undefined) {
writer.uint32(26).string(message.create_date_time);
}
if (message.modify_date_time !== undefined) {
writer.uint32(34).string(message.modify_date_time);
}
if (message.status !== undefined) {
writer.uint32(40).int32(message.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 = createBaseRecommendationSubscription();
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 !== 16) {
break;
}
message.type = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.create_date_time = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.modify_date_time = reader.string();
continue;
case 5:
if (tag !== 40) {
break;
}
message.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) : "",
type: isSet(object.type) ? (0, recommendation_type_js_1.recommendationTypeEnum_RecommendationTypeFromJSON)(object.type) : 0,
create_date_time: isSet(object.create_date_time) ? globalThis.String(object.create_date_time) : undefined,
modify_date_time: isSet(object.modify_date_time) ? globalThis.String(object.modify_date_time) : undefined,
status: isSet(object.status)
? (0, recommendation_subscription_status_js_1.recommendationSubscriptionStatusEnum_RecommendationSubscriptionStatusFromJSON)(object.status)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.type !== undefined && message.type !== 0) {
obj.type = (0, recommendation_type_js_1.recommendationTypeEnum_RecommendationTypeToJSON)(message.type);
}
if (message.create_date_time !== undefined) {
obj.create_date_time = message.create_date_time;
}
if (message.modify_date_time !== undefined) {
obj.modify_date_time = message.modify_date_time;
}
if (message.status !== undefined) {
obj.status = (0, recommendation_subscription_status_js_1.recommendationSubscriptionStatusEnum_RecommendationSubscriptionStatusToJSON)(message.status);
}
return obj;
},
create(base) {
return exports.RecommendationSubscription.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBaseRecommendationSubscription();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.type = (_b = object.type) !== null && _b !== void 0 ? _b : 0;
message.create_date_time = (_c = object.create_date_time) !== null && _c !== void 0 ? _c : undefined;
message.modify_date_time = (_d = object.modify_date_time) !== null && _d !== void 0 ? _d : undefined;
message.status = (_e = object.status) !== null && _e !== void 0 ? _e : undefined;
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}