@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
263 lines (262 loc) • 11.7 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/asset_policy.proto
/* eslint-disable */
import _m0 from "protobufjs/minimal.js";
import { assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusFromJSON, assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusToJSON, } from "../enums/asset_link_primary_status.js";
import { assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonFromJSON, assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonToJSON, } from "../enums/asset_link_primary_status_reason.js";
import { assetOfflineEvaluationErrorReasonsEnum_AssetOfflineEvaluationErrorReasonsFromJSON, assetOfflineEvaluationErrorReasonsEnum_AssetOfflineEvaluationErrorReasonsToJSON, } from "../enums/asset_offline_evaluation_error_reasons.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 createBaseAdAssetPolicySummary() {
return { policy_topic_entries: [], review_status: 0, approval_status: 0 };
}
export const AdAssetPolicySummary = {
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 = createBaseAdAssetPolicySummary();
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 AdAssetPolicySummary.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseAdAssetPolicySummary();
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 createBaseAssetLinkPrimaryStatusDetails() {
return { reason: undefined, status: undefined, asset_disapproved: undefined };
}
export const AssetLinkPrimaryStatusDetails = {
encode(message, writer = _m0.Writer.create()) {
if (message.reason !== undefined) {
writer.uint32(8).int32(message.reason);
}
if (message.status !== undefined) {
writer.uint32(16).int32(message.status);
}
if (message.asset_disapproved !== undefined) {
AssetDisapproved.encode(message.asset_disapproved, writer.uint32(26).fork()).ldelim();
}
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 = createBaseAssetLinkPrimaryStatusDetails();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.reason = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.status = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.asset_disapproved = AssetDisapproved.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
reason: isSet(object.reason)
? assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonFromJSON(object.reason)
: undefined,
status: isSet(object.status)
? assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusFromJSON(object.status)
: undefined,
asset_disapproved: isSet(object.asset_disapproved)
? AssetDisapproved.fromJSON(object.asset_disapproved)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.reason !== undefined) {
obj.reason = assetLinkPrimaryStatusReasonEnum_AssetLinkPrimaryStatusReasonToJSON(message.reason);
}
if (message.status !== undefined) {
obj.status = assetLinkPrimaryStatusEnum_AssetLinkPrimaryStatusToJSON(message.status);
}
if (message.asset_disapproved !== undefined) {
obj.asset_disapproved = AssetDisapproved.toJSON(message.asset_disapproved);
}
return obj;
},
create(base) {
return AssetLinkPrimaryStatusDetails.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseAssetLinkPrimaryStatusDetails();
message.reason = (_a = object.reason) !== null && _a !== void 0 ? _a : undefined;
message.status = (_b = object.status) !== null && _b !== void 0 ? _b : undefined;
message.asset_disapproved = (object.asset_disapproved !== undefined && object.asset_disapproved !== null)
? AssetDisapproved.fromPartial(object.asset_disapproved)
: undefined;
return message;
},
};
function createBaseAssetDisapproved() {
return { offline_evaluation_error_reasons: [] };
}
export const AssetDisapproved = {
encode(message, writer = _m0.Writer.create()) {
if (message.offline_evaluation_error_reasons !== undefined && message.offline_evaluation_error_reasons.length !== 0) {
writer.uint32(10).fork();
for (const v of message.offline_evaluation_error_reasons) {
writer.int32(v);
}
writer.ldelim();
}
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 = createBaseAssetDisapproved();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag === 8) {
message.offline_evaluation_error_reasons.push(reader.int32());
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.offline_evaluation_error_reasons.push(reader.int32());
}
continue;
}
break;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
offline_evaluation_error_reasons: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.offline_evaluation_error_reasons)
? object.offline_evaluation_error_reasons.map((e) => assetOfflineEvaluationErrorReasonsEnum_AssetOfflineEvaluationErrorReasonsFromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.offline_evaluation_error_reasons) === null || _a === void 0 ? void 0 : _a.length) {
obj.offline_evaluation_error_reasons = message.offline_evaluation_error_reasons.map((e) => assetOfflineEvaluationErrorReasonsEnum_AssetOfflineEvaluationErrorReasonsToJSON(e));
}
return obj;
},
create(base) {
return AssetDisapproved.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseAssetDisapproved();
message.offline_evaluation_error_reasons = ((_a = object.offline_evaluation_error_reasons) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}