@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
1,064 lines (1,063 loc) • 45.9 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/v20/common/policy.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { policyTopicEntryTypeEnum_PolicyTopicEntryTypeFromJSON, policyTopicEntryTypeEnum_PolicyTopicEntryTypeToJSON, } from "../enums/policy_topic_entry_type.js";
import { policyTopicEvidenceDestinationMismatchUrlTypeEnum_PolicyTopicEvidenceDestinationMismatchUrlTypeFromJSON, policyTopicEvidenceDestinationMismatchUrlTypeEnum_PolicyTopicEvidenceDestinationMismatchUrlTypeToJSON, } from "../enums/policy_topic_evidence_destination_mismatch_url_type.js";
import { policyTopicEvidenceDestinationNotWorkingDeviceEnum_PolicyTopicEvidenceDestinationNotWorkingDeviceFromJSON, policyTopicEvidenceDestinationNotWorkingDeviceEnum_PolicyTopicEvidenceDestinationNotWorkingDeviceToJSON, } from "../enums/policy_topic_evidence_destination_not_working_device.js";
import { policyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum_PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeFromJSON, policyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum_PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeToJSON, } from "../enums/policy_topic_evidence_destination_not_working_dns_error_type.js";
function createBasePolicyViolationKey() {
return { policy_name: undefined, violating_text: undefined };
}
export const PolicyViolationKey = {
encode(message, writer = _m0.Writer.create()) {
if (message.policy_name !== undefined) {
writer.uint32(26).string(message.policy_name);
}
if (message.violating_text !== undefined) {
writer.uint32(34).string(message.violating_text);
}
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 = createBasePolicyViolationKey();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.policy_name = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.violating_text = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
policy_name: isSet(object.policy_name) ? globalThis.String(object.policy_name) : undefined,
violating_text: isSet(object.violating_text) ? globalThis.String(object.violating_text) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.policy_name !== undefined) {
obj.policy_name = message.policy_name;
}
if (message.violating_text !== undefined) {
obj.violating_text = message.violating_text;
}
return obj;
},
create(base) {
return PolicyViolationKey.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBasePolicyViolationKey();
message.policy_name = (_a = object.policy_name) !== null && _a !== void 0 ? _a : undefined;
message.violating_text = (_b = object.violating_text) !== null && _b !== void 0 ? _b : undefined;
return message;
},
};
function createBasePolicyValidationParameter() {
return { ignorable_policy_topics: [], exempt_policy_violation_keys: [] };
}
export const PolicyValidationParameter = {
encode(message, writer = _m0.Writer.create()) {
if (message.ignorable_policy_topics !== undefined && message.ignorable_policy_topics.length !== 0) {
for (const v of message.ignorable_policy_topics) {
writer.uint32(26).string(v);
}
}
if (message.exempt_policy_violation_keys !== undefined && message.exempt_policy_violation_keys.length !== 0) {
for (const v of message.exempt_policy_violation_keys) {
PolicyViolationKey.encode(v, writer.uint32(18).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 = createBasePolicyValidationParameter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.ignorable_policy_topics.push(reader.string());
continue;
case 2:
if (tag !== 18) {
break;
}
message.exempt_policy_violation_keys.push(PolicyViolationKey.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
ignorable_policy_topics: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.ignorable_policy_topics)
? object.ignorable_policy_topics.map((e) => globalThis.String(e))
: [],
exempt_policy_violation_keys: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.exempt_policy_violation_keys)
? object.exempt_policy_violation_keys.map((e) => PolicyViolationKey.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if ((_a = message.ignorable_policy_topics) === null || _a === void 0 ? void 0 : _a.length) {
obj.ignorable_policy_topics = message.ignorable_policy_topics;
}
if ((_b = message.exempt_policy_violation_keys) === null || _b === void 0 ? void 0 : _b.length) {
obj.exempt_policy_violation_keys = message.exempt_policy_violation_keys.map((e) => PolicyViolationKey.toJSON(e));
}
return obj;
},
create(base) {
return PolicyValidationParameter.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBasePolicyValidationParameter();
message.ignorable_policy_topics = ((_a = object.ignorable_policy_topics) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
message.exempt_policy_violation_keys =
((_b = object.exempt_policy_violation_keys) === null || _b === void 0 ? void 0 : _b.map((e) => PolicyViolationKey.fromPartial(e))) || [];
return message;
},
};
function createBasePolicyTopicEntry() {
return { topic: undefined, type: 0, evidences: [], constraints: [] };
}
export const PolicyTopicEntry = {
encode(message, writer = _m0.Writer.create()) {
if (message.topic !== undefined) {
writer.uint32(42).string(message.topic);
}
if (message.type !== undefined && message.type !== 0) {
writer.uint32(16).int32(message.type);
}
if (message.evidences !== undefined && message.evidences.length !== 0) {
for (const v of message.evidences) {
PolicyTopicEvidence.encode(v, writer.uint32(26).fork()).ldelim();
}
}
if (message.constraints !== undefined && message.constraints.length !== 0) {
for (const v of message.constraints) {
PolicyTopicConstraint.encode(v, writer.uint32(34).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 = createBasePolicyTopicEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 5:
if (tag !== 42) {
break;
}
message.topic = reader.string();
continue;
case 2:
if (tag !== 16) {
break;
}
message.type = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.evidences.push(PolicyTopicEvidence.decode(reader, reader.uint32()));
continue;
case 4:
if (tag !== 34) {
break;
}
message.constraints.push(PolicyTopicConstraint.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
topic: isSet(object.topic) ? globalThis.String(object.topic) : undefined,
type: isSet(object.type) ? policyTopicEntryTypeEnum_PolicyTopicEntryTypeFromJSON(object.type) : 0,
evidences: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.evidences)
? object.evidences.map((e) => PolicyTopicEvidence.fromJSON(e))
: [],
constraints: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.constraints)
? object.constraints.map((e) => PolicyTopicConstraint.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if (message.topic !== undefined) {
obj.topic = message.topic;
}
if (message.type !== undefined && message.type !== 0) {
obj.type = policyTopicEntryTypeEnum_PolicyTopicEntryTypeToJSON(message.type);
}
if ((_a = message.evidences) === null || _a === void 0 ? void 0 : _a.length) {
obj.evidences = message.evidences.map((e) => PolicyTopicEvidence.toJSON(e));
}
if ((_b = message.constraints) === null || _b === void 0 ? void 0 : _b.length) {
obj.constraints = message.constraints.map((e) => PolicyTopicConstraint.toJSON(e));
}
return obj;
},
create(base) {
return PolicyTopicEntry.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBasePolicyTopicEntry();
message.topic = (_a = object.topic) !== null && _a !== void 0 ? _a : undefined;
message.type = (_b = object.type) !== null && _b !== void 0 ? _b : 0;
message.evidences = ((_c = object.evidences) === null || _c === void 0 ? void 0 : _c.map((e) => PolicyTopicEvidence.fromPartial(e))) || [];
message.constraints = ((_d = object.constraints) === null || _d === void 0 ? void 0 : _d.map((e) => PolicyTopicConstraint.fromPartial(e))) || [];
return message;
},
};
function createBasePolicyTopicEvidence() {
return {
website_list: undefined,
text_list: undefined,
language_code: undefined,
destination_text_list: undefined,
destination_mismatch: undefined,
destination_not_working: undefined,
};
}
export const PolicyTopicEvidence = {
encode(message, writer = _m0.Writer.create()) {
if (message.website_list !== undefined) {
PolicyTopicEvidence_WebsiteList.encode(message.website_list, writer.uint32(26).fork()).ldelim();
}
if (message.text_list !== undefined) {
PolicyTopicEvidence_TextList.encode(message.text_list, writer.uint32(34).fork()).ldelim();
}
if (message.language_code !== undefined) {
writer.uint32(74).string(message.language_code);
}
if (message.destination_text_list !== undefined) {
PolicyTopicEvidence_DestinationTextList.encode(message.destination_text_list, writer.uint32(50).fork()).ldelim();
}
if (message.destination_mismatch !== undefined) {
PolicyTopicEvidence_DestinationMismatch.encode(message.destination_mismatch, writer.uint32(58).fork()).ldelim();
}
if (message.destination_not_working !== undefined) {
PolicyTopicEvidence_DestinationNotWorking.encode(message.destination_not_working, writer.uint32(66).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 = createBasePolicyTopicEvidence();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.website_list = PolicyTopicEvidence_WebsiteList.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.text_list = PolicyTopicEvidence_TextList.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 74) {
break;
}
message.language_code = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.destination_text_list = PolicyTopicEvidence_DestinationTextList.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
message.destination_mismatch = PolicyTopicEvidence_DestinationMismatch.decode(reader, reader.uint32());
continue;
case 8:
if (tag !== 66) {
break;
}
message.destination_not_working = PolicyTopicEvidence_DestinationNotWorking.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
website_list: isSet(object.website_list)
? PolicyTopicEvidence_WebsiteList.fromJSON(object.website_list)
: undefined,
text_list: isSet(object.text_list) ? PolicyTopicEvidence_TextList.fromJSON(object.text_list) : undefined,
language_code: isSet(object.language_code) ? globalThis.String(object.language_code) : undefined,
destination_text_list: isSet(object.destination_text_list)
? PolicyTopicEvidence_DestinationTextList.fromJSON(object.destination_text_list)
: undefined,
destination_mismatch: isSet(object.destination_mismatch)
? PolicyTopicEvidence_DestinationMismatch.fromJSON(object.destination_mismatch)
: undefined,
destination_not_working: isSet(object.destination_not_working)
? PolicyTopicEvidence_DestinationNotWorking.fromJSON(object.destination_not_working)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.website_list !== undefined) {
obj.website_list = PolicyTopicEvidence_WebsiteList.toJSON(message.website_list);
}
if (message.text_list !== undefined) {
obj.text_list = PolicyTopicEvidence_TextList.toJSON(message.text_list);
}
if (message.language_code !== undefined) {
obj.language_code = message.language_code;
}
if (message.destination_text_list !== undefined) {
obj.destination_text_list = PolicyTopicEvidence_DestinationTextList.toJSON(message.destination_text_list);
}
if (message.destination_mismatch !== undefined) {
obj.destination_mismatch = PolicyTopicEvidence_DestinationMismatch.toJSON(message.destination_mismatch);
}
if (message.destination_not_working !== undefined) {
obj.destination_not_working = PolicyTopicEvidence_DestinationNotWorking.toJSON(message.destination_not_working);
}
return obj;
},
create(base) {
return PolicyTopicEvidence.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePolicyTopicEvidence();
message.website_list = (object.website_list !== undefined && object.website_list !== null)
? PolicyTopicEvidence_WebsiteList.fromPartial(object.website_list)
: undefined;
message.text_list = (object.text_list !== undefined && object.text_list !== null)
? PolicyTopicEvidence_TextList.fromPartial(object.text_list)
: undefined;
message.language_code = (_a = object.language_code) !== null && _a !== void 0 ? _a : undefined;
message.destination_text_list =
(object.destination_text_list !== undefined && object.destination_text_list !== null)
? PolicyTopicEvidence_DestinationTextList.fromPartial(object.destination_text_list)
: undefined;
message.destination_mismatch = (object.destination_mismatch !== undefined && object.destination_mismatch !== null)
? PolicyTopicEvidence_DestinationMismatch.fromPartial(object.destination_mismatch)
: undefined;
message.destination_not_working =
(object.destination_not_working !== undefined && object.destination_not_working !== null)
? PolicyTopicEvidence_DestinationNotWorking.fromPartial(object.destination_not_working)
: undefined;
return message;
},
};
function createBasePolicyTopicEvidence_TextList() {
return { texts: [] };
}
export const PolicyTopicEvidence_TextList = {
encode(message, writer = _m0.Writer.create()) {
if (message.texts !== undefined && message.texts.length !== 0) {
for (const v of message.texts) {
writer.uint32(18).string(v);
}
}
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 = createBasePolicyTopicEvidence_TextList();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.texts.push(reader.string());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { texts: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.texts) ? object.texts.map((e) => globalThis.String(e)) : [] };
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.texts) === null || _a === void 0 ? void 0 : _a.length) {
obj.texts = message.texts;
}
return obj;
},
create(base) {
return PolicyTopicEvidence_TextList.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePolicyTopicEvidence_TextList();
message.texts = ((_a = object.texts) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
function createBasePolicyTopicEvidence_WebsiteList() {
return { websites: [] };
}
export const PolicyTopicEvidence_WebsiteList = {
encode(message, writer = _m0.Writer.create()) {
if (message.websites !== undefined && message.websites.length !== 0) {
for (const v of message.websites) {
writer.uint32(18).string(v);
}
}
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 = createBasePolicyTopicEvidence_WebsiteList();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.websites.push(reader.string());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
websites: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.websites) ? object.websites.map((e) => globalThis.String(e)) : [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.websites) === null || _a === void 0 ? void 0 : _a.length) {
obj.websites = message.websites;
}
return obj;
},
create(base) {
return PolicyTopicEvidence_WebsiteList.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePolicyTopicEvidence_WebsiteList();
message.websites = ((_a = object.websites) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
function createBasePolicyTopicEvidence_DestinationTextList() {
return { destination_texts: [] };
}
export const PolicyTopicEvidence_DestinationTextList = {
encode(message, writer = _m0.Writer.create()) {
if (message.destination_texts !== undefined && message.destination_texts.length !== 0) {
for (const v of message.destination_texts) {
writer.uint32(18).string(v);
}
}
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 = createBasePolicyTopicEvidence_DestinationTextList();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.destination_texts.push(reader.string());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
destination_texts: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.destination_texts)
? object.destination_texts.map((e) => globalThis.String(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.destination_texts) === null || _a === void 0 ? void 0 : _a.length) {
obj.destination_texts = message.destination_texts;
}
return obj;
},
create(base) {
return PolicyTopicEvidence_DestinationTextList.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePolicyTopicEvidence_DestinationTextList();
message.destination_texts = ((_a = object.destination_texts) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
function createBasePolicyTopicEvidence_DestinationMismatch() {
return { url_types: [] };
}
export const PolicyTopicEvidence_DestinationMismatch = {
encode(message, writer = _m0.Writer.create()) {
if (message.url_types !== undefined && message.url_types.length !== 0) {
writer.uint32(10).fork();
for (const v of message.url_types) {
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 = createBasePolicyTopicEvidence_DestinationMismatch();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag === 8) {
message.url_types.push(reader.int32());
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.url_types.push(reader.int32());
}
continue;
}
break;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
url_types: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.url_types)
? object.url_types.map((e) => policyTopicEvidenceDestinationMismatchUrlTypeEnum_PolicyTopicEvidenceDestinationMismatchUrlTypeFromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.url_types) === null || _a === void 0 ? void 0 : _a.length) {
obj.url_types = message.url_types.map((e) => policyTopicEvidenceDestinationMismatchUrlTypeEnum_PolicyTopicEvidenceDestinationMismatchUrlTypeToJSON(e));
}
return obj;
},
create(base) {
return PolicyTopicEvidence_DestinationMismatch.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePolicyTopicEvidence_DestinationMismatch();
message.url_types = ((_a = object.url_types) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
return message;
},
};
function createBasePolicyTopicEvidence_DestinationNotWorking() {
return {
expanded_url: undefined,
device: 0,
last_checked_date_time: undefined,
dns_error_type: undefined,
http_error_code: undefined,
};
}
export const PolicyTopicEvidence_DestinationNotWorking = {
encode(message, writer = _m0.Writer.create()) {
if (message.expanded_url !== undefined) {
writer.uint32(58).string(message.expanded_url);
}
if (message.device !== undefined && message.device !== 0) {
writer.uint32(32).int32(message.device);
}
if (message.last_checked_date_time !== undefined) {
writer.uint32(66).string(message.last_checked_date_time);
}
if (message.dns_error_type !== undefined) {
writer.uint32(8).int32(message.dns_error_type);
}
if (message.http_error_code !== undefined) {
writer.uint32(48).int64(message.http_error_code);
}
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 = createBasePolicyTopicEvidence_DestinationNotWorking();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 7:
if (tag !== 58) {
break;
}
message.expanded_url = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.device = reader.int32();
continue;
case 8:
if (tag !== 66) {
break;
}
message.last_checked_date_time = reader.string();
continue;
case 1:
if (tag !== 8) {
break;
}
message.dns_error_type = reader.int32();
continue;
case 6:
if (tag !== 48) {
break;
}
message.http_error_code = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
expanded_url: isSet(object.expanded_url) ? globalThis.String(object.expanded_url) : undefined,
device: isSet(object.device)
? policyTopicEvidenceDestinationNotWorkingDeviceEnum_PolicyTopicEvidenceDestinationNotWorkingDeviceFromJSON(object.device)
: 0,
last_checked_date_time: isSet(object.last_checked_date_time)
? globalThis.String(object.last_checked_date_time)
: undefined,
dns_error_type: isSet(object.dns_error_type)
? policyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum_PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeFromJSON(object.dns_error_type)
: undefined,
http_error_code: isSet(object.http_error_code) ? globalThis.String(object.http_error_code) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.expanded_url !== undefined) {
obj.expanded_url = message.expanded_url;
}
if (message.device !== undefined && message.device !== 0) {
obj.device =
policyTopicEvidenceDestinationNotWorkingDeviceEnum_PolicyTopicEvidenceDestinationNotWorkingDeviceToJSON(message.device);
}
if (message.last_checked_date_time !== undefined) {
obj.last_checked_date_time = message.last_checked_date_time;
}
if (message.dns_error_type !== undefined) {
obj.dns_error_type =
policyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum_PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeToJSON(message.dns_error_type);
}
if (message.http_error_code !== undefined) {
obj.http_error_code = message.http_error_code;
}
return obj;
},
create(base) {
return PolicyTopicEvidence_DestinationNotWorking.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBasePolicyTopicEvidence_DestinationNotWorking();
message.expanded_url = (_a = object.expanded_url) !== null && _a !== void 0 ? _a : undefined;
message.device = (_b = object.device) !== null && _b !== void 0 ? _b : 0;
message.last_checked_date_time = (_c = object.last_checked_date_time) !== null && _c !== void 0 ? _c : undefined;
message.dns_error_type = (_d = object.dns_error_type) !== null && _d !== void 0 ? _d : undefined;
message.http_error_code = (_e = object.http_error_code) !== null && _e !== void 0 ? _e : undefined;
return message;
},
};
function createBasePolicyTopicConstraint() {
return {
country_constraint_list: undefined,
reseller_constraint: undefined,
certificate_missing_in_country_list: undefined,
certificate_domain_mismatch_in_country_list: undefined,
};
}
export const PolicyTopicConstraint = {
encode(message, writer = _m0.Writer.create()) {
if (message.country_constraint_list !== undefined) {
PolicyTopicConstraint_CountryConstraintList.encode(message.country_constraint_list, writer.uint32(10).fork())
.ldelim();
}
if (message.reseller_constraint !== undefined) {
PolicyTopicConstraint_ResellerConstraint.encode(message.reseller_constraint, writer.uint32(18).fork()).ldelim();
}
if (message.certificate_missing_in_country_list !== undefined) {
PolicyTopicConstraint_CountryConstraintList.encode(message.certificate_missing_in_country_list, writer.uint32(26).fork()).ldelim();
}
if (message.certificate_domain_mismatch_in_country_list !== undefined) {
PolicyTopicConstraint_CountryConstraintList.encode(message.certificate_domain_mismatch_in_country_list, writer.uint32(34).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 = createBasePolicyTopicConstraint();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.country_constraint_list = PolicyTopicConstraint_CountryConstraintList.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.reseller_constraint = PolicyTopicConstraint_ResellerConstraint.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.certificate_missing_in_country_list = PolicyTopicConstraint_CountryConstraintList.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.certificate_domain_mismatch_in_country_list = PolicyTopicConstraint_CountryConstraintList.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
country_constraint_list: isSet(object.country_constraint_list)
? PolicyTopicConstraint_CountryConstraintList.fromJSON(object.country_constraint_list)
: undefined,
reseller_constraint: isSet(object.reseller_constraint)
? PolicyTopicConstraint_ResellerConstraint.fromJSON(object.reseller_constraint)
: undefined,
certificate_missing_in_country_list: isSet(object.certificate_missing_in_country_list)
? PolicyTopicConstraint_CountryConstraintList.fromJSON(object.certificate_missing_in_country_list)
: undefined,
certificate_domain_mismatch_in_country_list: isSet(object.certificate_domain_mismatch_in_country_list)
? PolicyTopicConstraint_CountryConstraintList.fromJSON(object.certificate_domain_mismatch_in_country_list)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.country_constraint_list !== undefined) {
obj.country_constraint_list = PolicyTopicConstraint_CountryConstraintList.toJSON(message.country_constraint_list);
}
if (message.reseller_constraint !== undefined) {
obj.reseller_constraint = PolicyTopicConstraint_ResellerConstraint.toJSON(message.reseller_constraint);
}
if (message.certificate_missing_in_country_list !== undefined) {
obj.certificate_missing_in_country_list = PolicyTopicConstraint_CountryConstraintList.toJSON(message.certificate_missing_in_country_list);
}
if (message.certificate_domain_mismatch_in_country_list !== undefined) {
obj.certificate_domain_mismatch_in_country_list = PolicyTopicConstraint_CountryConstraintList.toJSON(message.certificate_domain_mismatch_in_country_list);
}
return obj;
},
create(base) {
return PolicyTopicConstraint.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBasePolicyTopicConstraint();
message.country_constraint_list =
(object.country_constraint_list !== undefined && object.country_constraint_list !== null)
? PolicyTopicConstraint_CountryConstraintList.fromPartial(object.country_constraint_list)
: undefined;
message.reseller_constraint = (object.reseller_constraint !== undefined && object.reseller_constraint !== null)
? PolicyTopicConstraint_ResellerConstraint.fromPartial(object.reseller_constraint)
: undefined;
message.certificate_missing_in_country_list =
(object.certificate_missing_in_country_list !== undefined && object.certificate_missing_in_country_list !== null)
? PolicyTopicConstraint_CountryConstraintList.fromPartial(object.certificate_missing_in_country_list)
: undefined;
message.certificate_domain_mismatch_in_country_list =
(object.certificate_domain_mismatch_in_country_list !== undefined &&
object.certificate_domain_mismatch_in_country_list !== null)
? PolicyTopicConstraint_CountryConstraintList.fromPartial(object.certificate_domain_mismatch_in_country_list)
: undefined;
return message;
},
};
function createBasePolicyTopicConstraint_CountryConstraintList() {
return { total_targeted_countries: undefined, countries: [] };
}
export const PolicyTopicConstraint_CountryConstraintList = {
encode(message, writer = _m0.Writer.create()) {
if (message.total_targeted_countries !== undefined) {
writer.uint32(24).int32(message.total_targeted_countries);
}
if (message.countries !== undefined && message.countries.length !== 0) {
for (const v of message.countries) {
PolicyTopicConstraint_CountryConstraint.encode(v, writer.uint32(18).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 = createBasePolicyTopicConstraint_CountryConstraintList();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 24) {
break;
}
message.total_targeted_countries = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.countries.push(PolicyTopicConstraint_CountryConstraint.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
total_targeted_countries: isSet(object.total_targeted_countries)
? globalThis.Number(object.total_targeted_countries)
: undefined,
countries: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.countries)
? object.countries.map((e) => PolicyTopicConstraint_CountryConstraint.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.total_targeted_countries !== undefined) {
obj.total_targeted_countries = Math.round(message.total_targeted_countries);
}
if ((_a = message.countries) === null || _a === void 0 ? void 0 : _a.length) {
obj.countries = message.countries.map((e) => PolicyTopicConstraint_CountryConstraint.toJSON(e));
}
return obj;
},
create(base) {
return PolicyTopicConstraint_CountryConstraintList.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBasePolicyTopicConstraint_CountryConstraintList();
message.total_targeted_countries = (_a = object.total_targeted_countries) !== null && _a !== void 0 ? _a : undefined;
message.countries = ((_b = object.countries) === null || _b === void 0 ? void 0 : _b.map((e) => PolicyTopicConstraint_CountryConstraint.fromPartial(e))) || [];
return message;
},
};
function createBasePolicyTopicConstraint_ResellerConstraint() {
return {};
}
export const PolicyTopicConstraint_ResellerConstraint = {
encode(_, writer = _m0.Writer.create()) {
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 = createBasePolicyTopicConstraint_ResellerConstraint();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return PolicyTopicConstraint_ResellerConstraint.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(_) {
const message = createBasePolicyTopicConstraint_ResellerConstraint();
return message;
},
};
function createBasePolicyTopicConstraint_CountryConstraint() {
return { country_criterion: undefined };
}
export const PolicyTopicConstraint_CountryConstraint = {
encode(message, writer = _m0.Writer.create()) {
if (message.country_criterion !== undefined) {
writer.uint32(18).string(message.country_criterion);
}
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 = createBasePolicyTopicConstraint_CountryConstraint();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.country_criterion = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
country_criterion: isSet(object.country_criterion) ? globalThis.String(object.country_criterion) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.country_criterion !== undefined) {
obj.country_criterion = message.country_criterion;
}
return obj;
},
create(base) {
return PolicyTopicConstraint_CountryConstraint.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBasePolicyTopicConstraint_CountryConstraint();
message.country_criterion = (_a = object.country_criterion) !== null && _a !== void 0 ? _a : undefined;
return message;
},
};
function longToString(long) {
return long.toString();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long;
_m0.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}