@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
334 lines (333 loc) • 14.6 kB
JavaScript
"use strict";
// 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/billing_setup.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BillingSetup_PaymentsAccountInfo = exports.BillingSetup = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const billing_setup_status_js_1 = require("../enums/billing_setup_status.js");
const time_type_js_1 = require("../enums/time_type.js");
function createBaseBillingSetup() {
return {
resource_name: "",
id: undefined,
status: 0,
payments_account: undefined,
payments_account_info: undefined,
start_date_time: undefined,
start_time_type: undefined,
end_date_time: undefined,
end_time_type: undefined,
};
}
exports.BillingSetup = {
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.id !== undefined) {
writer.uint32(120).int64(message.id);
}
if (message.status !== undefined && message.status !== 0) {
writer.uint32(24).int32(message.status);
}
if (message.payments_account !== undefined) {
writer.uint32(146).string(message.payments_account);
}
if (message.payments_account_info !== undefined) {
exports.BillingSetup_PaymentsAccountInfo.encode(message.payments_account_info, writer.uint32(98).fork()).ldelim();
}
if (message.start_date_time !== undefined) {
writer.uint32(130).string(message.start_date_time);
}
if (message.start_time_type !== undefined) {
writer.uint32(80).int32(message.start_time_type);
}
if (message.end_date_time !== undefined) {
writer.uint32(138).string(message.end_date_time);
}
if (message.end_time_type !== undefined) {
writer.uint32(112).int32(message.end_time_type);
}
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 = createBaseBillingSetup();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 15:
if (tag !== 120) {
break;
}
message.id = longToString(reader.int64());
continue;
case 3:
if (tag !== 24) {
break;
}
message.status = reader.int32();
continue;
case 18:
if (tag !== 146) {
break;
}
message.payments_account = reader.string();
continue;
case 12:
if (tag !== 98) {
break;
}
message.payments_account_info = exports.BillingSetup_PaymentsAccountInfo.decode(reader, reader.uint32());
continue;
case 16:
if (tag !== 130) {
break;
}
message.start_date_time = reader.string();
continue;
case 10:
if (tag !== 80) {
break;
}
message.start_time_type = reader.int32();
continue;
case 17:
if (tag !== 138) {
break;
}
message.end_date_time = reader.string();
continue;
case 14:
if (tag !== 112) {
break;
}
message.end_time_type = 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) : "",
id: isSet(object.id) ? globalThis.String(object.id) : undefined,
status: isSet(object.status) ? (0, billing_setup_status_js_1.billingSetupStatusEnum_BillingSetupStatusFromJSON)(object.status) : 0,
payments_account: isSet(object.payments_account) ? globalThis.String(object.payments_account) : undefined,
payments_account_info: isSet(object.payments_account_info)
? exports.BillingSetup_PaymentsAccountInfo.fromJSON(object.payments_account_info)
: undefined,
start_date_time: isSet(object.start_date_time) ? globalThis.String(object.start_date_time) : undefined,
start_time_type: isSet(object.start_time_type)
? (0, time_type_js_1.timeTypeEnum_TimeTypeFromJSON)(object.start_time_type)
: undefined,
end_date_time: isSet(object.end_date_time) ? globalThis.String(object.end_date_time) : undefined,
end_time_type: isSet(object.end_time_type) ? (0, time_type_js_1.timeTypeEnum_TimeTypeFromJSON)(object.end_time_type) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.id !== undefined) {
obj.id = message.id;
}
if (message.status !== undefined && message.status !== 0) {
obj.status = (0, billing_setup_status_js_1.billingSetupStatusEnum_BillingSetupStatusToJSON)(message.status);
}
if (message.payments_account !== undefined) {
obj.payments_account = message.payments_account;
}
if (message.payments_account_info !== undefined) {
obj.payments_account_info = exports.BillingSetup_PaymentsAccountInfo.toJSON(message.payments_account_info);
}
if (message.start_date_time !== undefined) {
obj.start_date_time = message.start_date_time;
}
if (message.start_time_type !== undefined) {
obj.start_time_type = (0, time_type_js_1.timeTypeEnum_TimeTypeToJSON)(message.start_time_type);
}
if (message.end_date_time !== undefined) {
obj.end_date_time = message.end_date_time;
}
if (message.end_time_type !== undefined) {
obj.end_time_type = (0, time_type_js_1.timeTypeEnum_TimeTypeToJSON)(message.end_time_type);
}
return obj;
},
create(base) {
return exports.BillingSetup.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h;
const message = createBaseBillingSetup();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined;
message.status = (_c = object.status) !== null && _c !== void 0 ? _c : 0;
message.payments_account = (_d = object.payments_account) !== null && _d !== void 0 ? _d : undefined;
message.payments_account_info =
(object.payments_account_info !== undefined && object.payments_account_info !== null)
? exports.BillingSetup_PaymentsAccountInfo.fromPartial(object.payments_account_info)
: undefined;
message.start_date_time = (_e = object.start_date_time) !== null && _e !== void 0 ? _e : undefined;
message.start_time_type = (_f = object.start_time_type) !== null && _f !== void 0 ? _f : undefined;
message.end_date_time = (_g = object.end_date_time) !== null && _g !== void 0 ? _g : undefined;
message.end_time_type = (_h = object.end_time_type) !== null && _h !== void 0 ? _h : undefined;
return message;
},
};
function createBaseBillingSetup_PaymentsAccountInfo() {
return {
payments_account_id: undefined,
payments_account_name: undefined,
payments_profile_id: undefined,
payments_profile_name: undefined,
secondary_payments_profile_id: undefined,
};
}
exports.BillingSetup_PaymentsAccountInfo = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.payments_account_id !== undefined) {
writer.uint32(50).string(message.payments_account_id);
}
if (message.payments_account_name !== undefined) {
writer.uint32(58).string(message.payments_account_name);
}
if (message.payments_profile_id !== undefined) {
writer.uint32(66).string(message.payments_profile_id);
}
if (message.payments_profile_name !== undefined) {
writer.uint32(74).string(message.payments_profile_name);
}
if (message.secondary_payments_profile_id !== undefined) {
writer.uint32(82).string(message.secondary_payments_profile_id);
}
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 = createBaseBillingSetup_PaymentsAccountInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 6:
if (tag !== 50) {
break;
}
message.payments_account_id = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.payments_account_name = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.payments_profile_id = reader.string();
continue;
case 9:
if (tag !== 74) {
break;
}
message.payments_profile_name = reader.string();
continue;
case 10:
if (tag !== 82) {
break;
}
message.secondary_payments_profile_id = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
payments_account_id: isSet(object.payments_account_id)
? globalThis.String(object.payments_account_id)
: undefined,
payments_account_name: isSet(object.payments_account_name)
? globalThis.String(object.payments_account_name)
: undefined,
payments_profile_id: isSet(object.payments_profile_id)
? globalThis.String(object.payments_profile_id)
: undefined,
payments_profile_name: isSet(object.payments_profile_name)
? globalThis.String(object.payments_profile_name)
: undefined,
secondary_payments_profile_id: isSet(object.secondary_payments_profile_id)
? globalThis.String(object.secondary_payments_profile_id)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.payments_account_id !== undefined) {
obj.payments_account_id = message.payments_account_id;
}
if (message.payments_account_name !== undefined) {
obj.payments_account_name = message.payments_account_name;
}
if (message.payments_profile_id !== undefined) {
obj.payments_profile_id = message.payments_profile_id;
}
if (message.payments_profile_name !== undefined) {
obj.payments_profile_name = message.payments_profile_name;
}
if (message.secondary_payments_profile_id !== undefined) {
obj.secondary_payments_profile_id = message.secondary_payments_profile_id;
}
return obj;
},
create(base) {
return exports.BillingSetup_PaymentsAccountInfo.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBaseBillingSetup_PaymentsAccountInfo();
message.payments_account_id = (_a = object.payments_account_id) !== null && _a !== void 0 ? _a : undefined;
message.payments_account_name = (_b = object.payments_account_name) !== null && _b !== void 0 ? _b : undefined;
message.payments_profile_id = (_c = object.payments_profile_id) !== null && _c !== void 0 ? _c : undefined;
message.payments_profile_name = (_d = object.payments_profile_name) !== null && _d !== void 0 ? _d : undefined;
message.secondary_payments_profile_id = (_e = object.secondary_payments_profile_id) !== null && _e !== void 0 ? _e : undefined;
return message;
},
};
function longToString(long) {
return long.toString();
}
if (minimal_js_1.default.util.Long !== long_1.default) {
minimal_js_1.default.util.Long = long_1.default;
minimal_js_1.default.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}