@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
427 lines (426 loc) • 21 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/v21/resources/account_budget_proposal.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountBudgetProposal = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const account_budget_proposal_status_js_1 = require("../enums/account_budget_proposal_status.js");
const account_budget_proposal_type_js_1 = require("../enums/account_budget_proposal_type.js");
const spending_limit_type_js_1 = require("../enums/spending_limit_type.js");
const time_type_js_1 = require("../enums/time_type.js");
function createBaseAccountBudgetProposal() {
return {
resource_name: "",
id: undefined,
billing_setup: undefined,
account_budget: undefined,
proposal_type: 0,
status: 0,
proposed_name: undefined,
approved_start_date_time: undefined,
proposed_purchase_order_number: undefined,
proposed_notes: undefined,
creation_date_time: undefined,
approval_date_time: undefined,
proposed_start_date_time: undefined,
proposed_start_time_type: undefined,
proposed_end_date_time: undefined,
proposed_end_time_type: undefined,
approved_end_date_time: undefined,
approved_end_time_type: undefined,
proposed_spending_limit_micros: undefined,
proposed_spending_limit_type: undefined,
approved_spending_limit_micros: undefined,
approved_spending_limit_type: undefined,
};
}
exports.AccountBudgetProposal = {
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(200).int64(message.id);
}
if (message.billing_setup !== undefined) {
writer.uint32(210).string(message.billing_setup);
}
if (message.account_budget !== undefined) {
writer.uint32(218).string(message.account_budget);
}
if (message.proposal_type !== undefined && message.proposal_type !== 0) {
writer.uint32(32).int32(message.proposal_type);
}
if (message.status !== undefined && message.status !== 0) {
writer.uint32(120).int32(message.status);
}
if (message.proposed_name !== undefined) {
writer.uint32(226).string(message.proposed_name);
}
if (message.approved_start_date_time !== undefined) {
writer.uint32(242).string(message.approved_start_date_time);
}
if (message.proposed_purchase_order_number !== undefined) {
writer.uint32(282).string(message.proposed_purchase_order_number);
}
if (message.proposed_notes !== undefined) {
writer.uint32(290).string(message.proposed_notes);
}
if (message.creation_date_time !== undefined) {
writer.uint32(298).string(message.creation_date_time);
}
if (message.approval_date_time !== undefined) {
writer.uint32(306).string(message.approval_date_time);
}
if (message.proposed_start_date_time !== undefined) {
writer.uint32(234).string(message.proposed_start_date_time);
}
if (message.proposed_start_time_type !== undefined) {
writer.uint32(56).int32(message.proposed_start_time_type);
}
if (message.proposed_end_date_time !== undefined) {
writer.uint32(250).string(message.proposed_end_date_time);
}
if (message.proposed_end_time_type !== undefined) {
writer.uint32(72).int32(message.proposed_end_time_type);
}
if (message.approved_end_date_time !== undefined) {
writer.uint32(258).string(message.approved_end_date_time);
}
if (message.approved_end_time_type !== undefined) {
writer.uint32(176).int32(message.approved_end_time_type);
}
if (message.proposed_spending_limit_micros !== undefined) {
writer.uint32(264).int64(message.proposed_spending_limit_micros);
}
if (message.proposed_spending_limit_type !== undefined) {
writer.uint32(88).int32(message.proposed_spending_limit_type);
}
if (message.approved_spending_limit_micros !== undefined) {
writer.uint32(272).int64(message.approved_spending_limit_micros);
}
if (message.approved_spending_limit_type !== undefined) {
writer.uint32(192).int32(message.approved_spending_limit_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 = createBaseAccountBudgetProposal();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 25:
if (tag !== 200) {
break;
}
message.id = longToString(reader.int64());
continue;
case 26:
if (tag !== 210) {
break;
}
message.billing_setup = reader.string();
continue;
case 27:
if (tag !== 218) {
break;
}
message.account_budget = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.proposal_type = reader.int32();
continue;
case 15:
if (tag !== 120) {
break;
}
message.status = reader.int32();
continue;
case 28:
if (tag !== 226) {
break;
}
message.proposed_name = reader.string();
continue;
case 30:
if (tag !== 242) {
break;
}
message.approved_start_date_time = reader.string();
continue;
case 35:
if (tag !== 282) {
break;
}
message.proposed_purchase_order_number = reader.string();
continue;
case 36:
if (tag !== 290) {
break;
}
message.proposed_notes = reader.string();
continue;
case 37:
if (tag !== 298) {
break;
}
message.creation_date_time = reader.string();
continue;
case 38:
if (tag !== 306) {
break;
}
message.approval_date_time = reader.string();
continue;
case 29:
if (tag !== 234) {
break;
}
message.proposed_start_date_time = reader.string();
continue;
case 7:
if (tag !== 56) {
break;
}
message.proposed_start_time_type = reader.int32();
continue;
case 31:
if (tag !== 250) {
break;
}
message.proposed_end_date_time = reader.string();
continue;
case 9:
if (tag !== 72) {
break;
}
message.proposed_end_time_type = reader.int32();
continue;
case 32:
if (tag !== 258) {
break;
}
message.approved_end_date_time = reader.string();
continue;
case 22:
if (tag !== 176) {
break;
}
message.approved_end_time_type = reader.int32();
continue;
case 33:
if (tag !== 264) {
break;
}
message.proposed_spending_limit_micros = longToString(reader.int64());
continue;
case 11:
if (tag !== 88) {
break;
}
message.proposed_spending_limit_type = reader.int32();
continue;
case 34:
if (tag !== 272) {
break;
}
message.approved_spending_limit_micros = longToString(reader.int64());
continue;
case 24:
if (tag !== 192) {
break;
}
message.approved_spending_limit_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,
billing_setup: isSet(object.billing_setup) ? globalThis.String(object.billing_setup) : undefined,
account_budget: isSet(object.account_budget) ? globalThis.String(object.account_budget) : undefined,
proposal_type: isSet(object.proposal_type)
? (0, account_budget_proposal_type_js_1.accountBudgetProposalTypeEnum_AccountBudgetProposalTypeFromJSON)(object.proposal_type)
: 0,
status: isSet(object.status)
? (0, account_budget_proposal_status_js_1.accountBudgetProposalStatusEnum_AccountBudgetProposalStatusFromJSON)(object.status)
: 0,
proposed_name: isSet(object.proposed_name) ? globalThis.String(object.proposed_name) : undefined,
approved_start_date_time: isSet(object.approved_start_date_time)
? globalThis.String(object.approved_start_date_time)
: undefined,
proposed_purchase_order_number: isSet(object.proposed_purchase_order_number)
? globalThis.String(object.proposed_purchase_order_number)
: undefined,
proposed_notes: isSet(object.proposed_notes) ? globalThis.String(object.proposed_notes) : undefined,
creation_date_time: isSet(object.creation_date_time) ? globalThis.String(object.creation_date_time) : undefined,
approval_date_time: isSet(object.approval_date_time) ? globalThis.String(object.approval_date_time) : undefined,
proposed_start_date_time: isSet(object.proposed_start_date_time)
? globalThis.String(object.proposed_start_date_time)
: undefined,
proposed_start_time_type: isSet(object.proposed_start_time_type)
? (0, time_type_js_1.timeTypeEnum_TimeTypeFromJSON)(object.proposed_start_time_type)
: undefined,
proposed_end_date_time: isSet(object.proposed_end_date_time)
? globalThis.String(object.proposed_end_date_time)
: undefined,
proposed_end_time_type: isSet(object.proposed_end_time_type)
? (0, time_type_js_1.timeTypeEnum_TimeTypeFromJSON)(object.proposed_end_time_type)
: undefined,
approved_end_date_time: isSet(object.approved_end_date_time)
? globalThis.String(object.approved_end_date_time)
: undefined,
approved_end_time_type: isSet(object.approved_end_time_type)
? (0, time_type_js_1.timeTypeEnum_TimeTypeFromJSON)(object.approved_end_time_type)
: undefined,
proposed_spending_limit_micros: isSet(object.proposed_spending_limit_micros)
? globalThis.String(object.proposed_spending_limit_micros)
: undefined,
proposed_spending_limit_type: isSet(object.proposed_spending_limit_type)
? (0, spending_limit_type_js_1.spendingLimitTypeEnum_SpendingLimitTypeFromJSON)(object.proposed_spending_limit_type)
: undefined,
approved_spending_limit_micros: isSet(object.approved_spending_limit_micros)
? globalThis.String(object.approved_spending_limit_micros)
: undefined,
approved_spending_limit_type: isSet(object.approved_spending_limit_type)
? (0, spending_limit_type_js_1.spendingLimitTypeEnum_SpendingLimitTypeFromJSON)(object.approved_spending_limit_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.billing_setup !== undefined) {
obj.billing_setup = message.billing_setup;
}
if (message.account_budget !== undefined) {
obj.account_budget = message.account_budget;
}
if (message.proposal_type !== undefined && message.proposal_type !== 0) {
obj.proposal_type = (0, account_budget_proposal_type_js_1.accountBudgetProposalTypeEnum_AccountBudgetProposalTypeToJSON)(message.proposal_type);
}
if (message.status !== undefined && message.status !== 0) {
obj.status = (0, account_budget_proposal_status_js_1.accountBudgetProposalStatusEnum_AccountBudgetProposalStatusToJSON)(message.status);
}
if (message.proposed_name !== undefined) {
obj.proposed_name = message.proposed_name;
}
if (message.approved_start_date_time !== undefined) {
obj.approved_start_date_time = message.approved_start_date_time;
}
if (message.proposed_purchase_order_number !== undefined) {
obj.proposed_purchase_order_number = message.proposed_purchase_order_number;
}
if (message.proposed_notes !== undefined) {
obj.proposed_notes = message.proposed_notes;
}
if (message.creation_date_time !== undefined) {
obj.creation_date_time = message.creation_date_time;
}
if (message.approval_date_time !== undefined) {
obj.approval_date_time = message.approval_date_time;
}
if (message.proposed_start_date_time !== undefined) {
obj.proposed_start_date_time = message.proposed_start_date_time;
}
if (message.proposed_start_time_type !== undefined) {
obj.proposed_start_time_type = (0, time_type_js_1.timeTypeEnum_TimeTypeToJSON)(message.proposed_start_time_type);
}
if (message.proposed_end_date_time !== undefined) {
obj.proposed_end_date_time = message.proposed_end_date_time;
}
if (message.proposed_end_time_type !== undefined) {
obj.proposed_end_time_type = (0, time_type_js_1.timeTypeEnum_TimeTypeToJSON)(message.proposed_end_time_type);
}
if (message.approved_end_date_time !== undefined) {
obj.approved_end_date_time = message.approved_end_date_time;
}
if (message.approved_end_time_type !== undefined) {
obj.approved_end_time_type = (0, time_type_js_1.timeTypeEnum_TimeTypeToJSON)(message.approved_end_time_type);
}
if (message.proposed_spending_limit_micros !== undefined) {
obj.proposed_spending_limit_micros = message.proposed_spending_limit_micros;
}
if (message.proposed_spending_limit_type !== undefined) {
obj.proposed_spending_limit_type = (0, spending_limit_type_js_1.spendingLimitTypeEnum_SpendingLimitTypeToJSON)(message.proposed_spending_limit_type);
}
if (message.approved_spending_limit_micros !== undefined) {
obj.approved_spending_limit_micros = message.approved_spending_limit_micros;
}
if (message.approved_spending_limit_type !== undefined) {
obj.approved_spending_limit_type = (0, spending_limit_type_js_1.spendingLimitTypeEnum_SpendingLimitTypeToJSON)(message.approved_spending_limit_type);
}
return obj;
},
create(base) {
return exports.AccountBudgetProposal.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
const message = createBaseAccountBudgetProposal();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined;
message.billing_setup = (_c = object.billing_setup) !== null && _c !== void 0 ? _c : undefined;
message.account_budget = (_d = object.account_budget) !== null && _d !== void 0 ? _d : undefined;
message.proposal_type = (_e = object.proposal_type) !== null && _e !== void 0 ? _e : 0;
message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
message.proposed_name = (_g = object.proposed_name) !== null && _g !== void 0 ? _g : undefined;
message.approved_start_date_time = (_h = object.approved_start_date_time) !== null && _h !== void 0 ? _h : undefined;
message.proposed_purchase_order_number = (_j = object.proposed_purchase_order_number) !== null && _j !== void 0 ? _j : undefined;
message.proposed_notes = (_k = object.proposed_notes) !== null && _k !== void 0 ? _k : undefined;
message.creation_date_time = (_l = object.creation_date_time) !== null && _l !== void 0 ? _l : undefined;
message.approval_date_time = (_m = object.approval_date_time) !== null && _m !== void 0 ? _m : undefined;
message.proposed_start_date_time = (_o = object.proposed_start_date_time) !== null && _o !== void 0 ? _o : undefined;
message.proposed_start_time_type = (_p = object.proposed_start_time_type) !== null && _p !== void 0 ? _p : undefined;
message.proposed_end_date_time = (_q = object.proposed_end_date_time) !== null && _q !== void 0 ? _q : undefined;
message.proposed_end_time_type = (_r = object.proposed_end_time_type) !== null && _r !== void 0 ? _r : undefined;
message.approved_end_date_time = (_s = object.approved_end_date_time) !== null && _s !== void 0 ? _s : undefined;
message.approved_end_time_type = (_t = object.approved_end_time_type) !== null && _t !== void 0 ? _t : undefined;
message.proposed_spending_limit_micros = (_u = object.proposed_spending_limit_micros) !== null && _u !== void 0 ? _u : undefined;
message.proposed_spending_limit_type = (_v = object.proposed_spending_limit_type) !== null && _v !== void 0 ? _v : undefined;
message.approved_spending_limit_micros = (_w = object.approved_spending_limit_micros) !== null && _w !== void 0 ? _w : undefined;
message.approved_spending_limit_type = (_x = object.approved_spending_limit_type) !== null && _x !== void 0 ? _x : 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;
}