@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
110 lines (109 loc) • 5.03 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/common/policy_summary.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PolicySummary = void 0;
/* eslint-disable */
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const policy_approval_status_js_1 = require("../enums/policy_approval_status.js");
const policy_review_status_js_1 = require("../enums/policy_review_status.js");
const policy_js_1 = require("./policy.js");
function createBasePolicySummary() {
return { policy_topic_entries: [], review_status: 0, approval_status: 0 };
}
exports.PolicySummary = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.policy_topic_entries !== undefined && message.policy_topic_entries.length !== 0) {
for (const v of message.policy_topic_entries) {
policy_js_1.PolicyTopicEntry.encode(v, writer.uint32(10).fork()).ldelim();
}
}
if (message.review_status !== undefined && message.review_status !== 0) {
writer.uint32(16).int32(message.review_status);
}
if (message.approval_status !== undefined && message.approval_status !== 0) {
writer.uint32(24).int32(message.approval_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 = createBasePolicySummary();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.policy_topic_entries.push(policy_js_1.PolicyTopicEntry.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 16) {
break;
}
message.review_status = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.approval_status = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
policy_topic_entries: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.policy_topic_entries)
? object.policy_topic_entries.map((e) => policy_js_1.PolicyTopicEntry.fromJSON(e))
: [],
review_status: isSet(object.review_status)
? (0, policy_review_status_js_1.policyReviewStatusEnum_PolicyReviewStatusFromJSON)(object.review_status)
: 0,
approval_status: isSet(object.approval_status)
? (0, policy_approval_status_js_1.policyApprovalStatusEnum_PolicyApprovalStatusFromJSON)(object.approval_status)
: 0,
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.policy_topic_entries) === null || _a === void 0 ? void 0 : _a.length) {
obj.policy_topic_entries = message.policy_topic_entries.map((e) => policy_js_1.PolicyTopicEntry.toJSON(e));
}
if (message.review_status !== undefined && message.review_status !== 0) {
obj.review_status = (0, policy_review_status_js_1.policyReviewStatusEnum_PolicyReviewStatusToJSON)(message.review_status);
}
if (message.approval_status !== undefined && message.approval_status !== 0) {
obj.approval_status = (0, policy_approval_status_js_1.policyApprovalStatusEnum_PolicyApprovalStatusToJSON)(message.approval_status);
}
return obj;
},
create(base) {
return exports.PolicySummary.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBasePolicySummary();
message.policy_topic_entries = ((_a = object.policy_topic_entries) === null || _a === void 0 ? void 0 : _a.map((e) => policy_js_1.PolicyTopicEntry.fromPartial(e))) || [];
message.review_status = (_b = object.review_status) !== null && _b !== void 0 ? _b : 0;
message.approval_status = (_c = object.approval_status) !== null && _c !== void 0 ? _c : 0;
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}