@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
104 lines (103 loc) • 4.67 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
/* eslint-disable */
import _m0 from "protobufjs/minimal.js";
import { policyApprovalStatusEnum_PolicyApprovalStatusFromJSON, policyApprovalStatusEnum_PolicyApprovalStatusToJSON, } from "../enums/policy_approval_status.js";
import { policyReviewStatusEnum_PolicyReviewStatusFromJSON, policyReviewStatusEnum_PolicyReviewStatusToJSON, } from "../enums/policy_review_status.js";
import { PolicyTopicEntry } from "./policy.js";
function createBasePolicySummary() {
return { policy_topic_entries: [], review_status: 0, approval_status: 0 };
}
export const PolicySummary = {
encode(message, writer = _m0.Writer.create()) {
if (message.policy_topic_entries !== undefined && message.policy_topic_entries.length !== 0) {
for (const v of message.policy_topic_entries) {
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 _m0.Reader ? input : _m0.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(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) => PolicyTopicEntry.fromJSON(e))
: [],
review_status: isSet(object.review_status)
? policyReviewStatusEnum_PolicyReviewStatusFromJSON(object.review_status)
: 0,
approval_status: isSet(object.approval_status)
? 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) => PolicyTopicEntry.toJSON(e));
}
if (message.review_status !== undefined && message.review_status !== 0) {
obj.review_status = policyReviewStatusEnum_PolicyReviewStatusToJSON(message.review_status);
}
if (message.approval_status !== undefined && message.approval_status !== 0) {
obj.approval_status = policyApprovalStatusEnum_PolicyApprovalStatusToJSON(message.approval_status);
}
return obj;
},
create(base) {
return 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) => 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;
}