UNPKG

@htdangkhoa/google-ads

Version:
357 lines (356 loc) 17.6 kB
// 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/campaign_budget.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; import { budgetDeliveryMethodEnum_BudgetDeliveryMethodFromJSON, budgetDeliveryMethodEnum_BudgetDeliveryMethodToJSON, } from "../enums/budget_delivery_method.js"; import { budgetPeriodEnum_BudgetPeriodFromJSON, budgetPeriodEnum_BudgetPeriodToJSON, } from "../enums/budget_period.js"; import { budgetStatusEnum_BudgetStatusFromJSON, budgetStatusEnum_BudgetStatusToJSON, } from "../enums/budget_status.js"; import { budgetTypeEnum_BudgetTypeFromJSON, budgetTypeEnum_BudgetTypeToJSON, } from "../enums/budget_type.js"; function createBaseCampaignBudget() { return { resource_name: "", id: undefined, name: undefined, amount_micros: undefined, total_amount_micros: undefined, status: 0, delivery_method: 0, explicitly_shared: undefined, reference_count: undefined, has_recommended_budget: undefined, recommended_budget_amount_micros: undefined, period: 0, recommended_budget_estimated_change_weekly_clicks: undefined, recommended_budget_estimated_change_weekly_cost_micros: undefined, recommended_budget_estimated_change_weekly_interactions: undefined, recommended_budget_estimated_change_weekly_views: undefined, type: 0, aligned_bidding_strategy_id: "0", }; } export const CampaignBudget = { encode(message, writer = _m0.Writer.create()) { if (message.resource_name !== undefined && message.resource_name !== "") { writer.uint32(10).string(message.resource_name); } if (message.id !== undefined) { writer.uint32(152).int64(message.id); } if (message.name !== undefined) { writer.uint32(162).string(message.name); } if (message.amount_micros !== undefined) { writer.uint32(168).int64(message.amount_micros); } if (message.total_amount_micros !== undefined) { writer.uint32(176).int64(message.total_amount_micros); } if (message.status !== undefined && message.status !== 0) { writer.uint32(48).int32(message.status); } if (message.delivery_method !== undefined && message.delivery_method !== 0) { writer.uint32(56).int32(message.delivery_method); } if (message.explicitly_shared !== undefined) { writer.uint32(184).bool(message.explicitly_shared); } if (message.reference_count !== undefined) { writer.uint32(192).int64(message.reference_count); } if (message.has_recommended_budget !== undefined) { writer.uint32(200).bool(message.has_recommended_budget); } if (message.recommended_budget_amount_micros !== undefined) { writer.uint32(208).int64(message.recommended_budget_amount_micros); } if (message.period !== undefined && message.period !== 0) { writer.uint32(104).int32(message.period); } if (message.recommended_budget_estimated_change_weekly_clicks !== undefined) { writer.uint32(216).int64(message.recommended_budget_estimated_change_weekly_clicks); } if (message.recommended_budget_estimated_change_weekly_cost_micros !== undefined) { writer.uint32(224).int64(message.recommended_budget_estimated_change_weekly_cost_micros); } if (message.recommended_budget_estimated_change_weekly_interactions !== undefined) { writer.uint32(232).int64(message.recommended_budget_estimated_change_weekly_interactions); } if (message.recommended_budget_estimated_change_weekly_views !== undefined) { writer.uint32(240).int64(message.recommended_budget_estimated_change_weekly_views); } if (message.type !== undefined && message.type !== 0) { writer.uint32(144).int32(message.type); } if (message.aligned_bidding_strategy_id !== undefined && message.aligned_bidding_strategy_id !== "0") { writer.uint32(248).int64(message.aligned_bidding_strategy_id); } 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 = createBaseCampaignBudget(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 19: if (tag !== 152) { break; } message.id = longToString(reader.int64()); continue; case 20: if (tag !== 162) { break; } message.name = reader.string(); continue; case 21: if (tag !== 168) { break; } message.amount_micros = longToString(reader.int64()); continue; case 22: if (tag !== 176) { break; } message.total_amount_micros = longToString(reader.int64()); continue; case 6: if (tag !== 48) { break; } message.status = reader.int32(); continue; case 7: if (tag !== 56) { break; } message.delivery_method = reader.int32(); continue; case 23: if (tag !== 184) { break; } message.explicitly_shared = reader.bool(); continue; case 24: if (tag !== 192) { break; } message.reference_count = longToString(reader.int64()); continue; case 25: if (tag !== 200) { break; } message.has_recommended_budget = reader.bool(); continue; case 26: if (tag !== 208) { break; } message.recommended_budget_amount_micros = longToString(reader.int64()); continue; case 13: if (tag !== 104) { break; } message.period = reader.int32(); continue; case 27: if (tag !== 216) { break; } message.recommended_budget_estimated_change_weekly_clicks = longToString(reader.int64()); continue; case 28: if (tag !== 224) { break; } message.recommended_budget_estimated_change_weekly_cost_micros = longToString(reader.int64()); continue; case 29: if (tag !== 232) { break; } message.recommended_budget_estimated_change_weekly_interactions = longToString(reader.int64()); continue; case 30: if (tag !== 240) { break; } message.recommended_budget_estimated_change_weekly_views = longToString(reader.int64()); continue; case 18: if (tag !== 144) { break; } message.type = reader.int32(); continue; case 31: if (tag !== 248) { break; } message.aligned_bidding_strategy_id = longToString(reader.int64()); 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, name: isSet(object.name) ? globalThis.String(object.name) : undefined, amount_micros: isSet(object.amount_micros) ? globalThis.String(object.amount_micros) : undefined, total_amount_micros: isSet(object.total_amount_micros) ? globalThis.String(object.total_amount_micros) : undefined, status: isSet(object.status) ? budgetStatusEnum_BudgetStatusFromJSON(object.status) : 0, delivery_method: isSet(object.delivery_method) ? budgetDeliveryMethodEnum_BudgetDeliveryMethodFromJSON(object.delivery_method) : 0, explicitly_shared: isSet(object.explicitly_shared) ? globalThis.Boolean(object.explicitly_shared) : undefined, reference_count: isSet(object.reference_count) ? globalThis.String(object.reference_count) : undefined, has_recommended_budget: isSet(object.has_recommended_budget) ? globalThis.Boolean(object.has_recommended_budget) : undefined, recommended_budget_amount_micros: isSet(object.recommended_budget_amount_micros) ? globalThis.String(object.recommended_budget_amount_micros) : undefined, period: isSet(object.period) ? budgetPeriodEnum_BudgetPeriodFromJSON(object.period) : 0, recommended_budget_estimated_change_weekly_clicks: isSet(object.recommended_budget_estimated_change_weekly_clicks) ? globalThis.String(object.recommended_budget_estimated_change_weekly_clicks) : undefined, recommended_budget_estimated_change_weekly_cost_micros: isSet(object.recommended_budget_estimated_change_weekly_cost_micros) ? globalThis.String(object.recommended_budget_estimated_change_weekly_cost_micros) : undefined, recommended_budget_estimated_change_weekly_interactions: isSet(object.recommended_budget_estimated_change_weekly_interactions) ? globalThis.String(object.recommended_budget_estimated_change_weekly_interactions) : undefined, recommended_budget_estimated_change_weekly_views: isSet(object.recommended_budget_estimated_change_weekly_views) ? globalThis.String(object.recommended_budget_estimated_change_weekly_views) : undefined, type: isSet(object.type) ? budgetTypeEnum_BudgetTypeFromJSON(object.type) : 0, aligned_bidding_strategy_id: isSet(object.aligned_bidding_strategy_id) ? globalThis.String(object.aligned_bidding_strategy_id) : "0", }; }, 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.name !== undefined) { obj.name = message.name; } if (message.amount_micros !== undefined) { obj.amount_micros = message.amount_micros; } if (message.total_amount_micros !== undefined) { obj.total_amount_micros = message.total_amount_micros; } if (message.status !== undefined && message.status !== 0) { obj.status = budgetStatusEnum_BudgetStatusToJSON(message.status); } if (message.delivery_method !== undefined && message.delivery_method !== 0) { obj.delivery_method = budgetDeliveryMethodEnum_BudgetDeliveryMethodToJSON(message.delivery_method); } if (message.explicitly_shared !== undefined) { obj.explicitly_shared = message.explicitly_shared; } if (message.reference_count !== undefined) { obj.reference_count = message.reference_count; } if (message.has_recommended_budget !== undefined) { obj.has_recommended_budget = message.has_recommended_budget; } if (message.recommended_budget_amount_micros !== undefined) { obj.recommended_budget_amount_micros = message.recommended_budget_amount_micros; } if (message.period !== undefined && message.period !== 0) { obj.period = budgetPeriodEnum_BudgetPeriodToJSON(message.period); } if (message.recommended_budget_estimated_change_weekly_clicks !== undefined) { obj.recommended_budget_estimated_change_weekly_clicks = message.recommended_budget_estimated_change_weekly_clicks; } if (message.recommended_budget_estimated_change_weekly_cost_micros !== undefined) { obj.recommended_budget_estimated_change_weekly_cost_micros = message.recommended_budget_estimated_change_weekly_cost_micros; } if (message.recommended_budget_estimated_change_weekly_interactions !== undefined) { obj.recommended_budget_estimated_change_weekly_interactions = message.recommended_budget_estimated_change_weekly_interactions; } if (message.recommended_budget_estimated_change_weekly_views !== undefined) { obj.recommended_budget_estimated_change_weekly_views = message.recommended_budget_estimated_change_weekly_views; } if (message.type !== undefined && message.type !== 0) { obj.type = budgetTypeEnum_BudgetTypeToJSON(message.type); } if (message.aligned_bidding_strategy_id !== undefined && message.aligned_bidding_strategy_id !== "0") { obj.aligned_bidding_strategy_id = message.aligned_bidding_strategy_id; } return obj; }, create(base) { return CampaignBudget.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; const message = createBaseCampaignBudget(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined; message.name = (_c = object.name) !== null && _c !== void 0 ? _c : undefined; message.amount_micros = (_d = object.amount_micros) !== null && _d !== void 0 ? _d : undefined; message.total_amount_micros = (_e = object.total_amount_micros) !== null && _e !== void 0 ? _e : undefined; message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0; message.delivery_method = (_g = object.delivery_method) !== null && _g !== void 0 ? _g : 0; message.explicitly_shared = (_h = object.explicitly_shared) !== null && _h !== void 0 ? _h : undefined; message.reference_count = (_j = object.reference_count) !== null && _j !== void 0 ? _j : undefined; message.has_recommended_budget = (_k = object.has_recommended_budget) !== null && _k !== void 0 ? _k : undefined; message.recommended_budget_amount_micros = (_l = object.recommended_budget_amount_micros) !== null && _l !== void 0 ? _l : undefined; message.period = (_m = object.period) !== null && _m !== void 0 ? _m : 0; message.recommended_budget_estimated_change_weekly_clicks = (_o = object.recommended_budget_estimated_change_weekly_clicks) !== null && _o !== void 0 ? _o : undefined; message.recommended_budget_estimated_change_weekly_cost_micros = (_p = object.recommended_budget_estimated_change_weekly_cost_micros) !== null && _p !== void 0 ? _p : undefined; message.recommended_budget_estimated_change_weekly_interactions = (_q = object.recommended_budget_estimated_change_weekly_interactions) !== null && _q !== void 0 ? _q : undefined; message.recommended_budget_estimated_change_weekly_views = (_r = object.recommended_budget_estimated_change_weekly_views) !== null && _r !== void 0 ? _r : undefined; message.type = (_s = object.type) !== null && _s !== void 0 ? _s : 0; message.aligned_bidding_strategy_id = (_t = object.aligned_bidding_strategy_id) !== null && _t !== void 0 ? _t : "0"; 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; }