google-ads-api-client
Version:
A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.
172 lines • 12.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CampaignBudget = void 0;
const runtime_1 = require("@protobuf-ts/runtime");
const runtime_2 = require("@protobuf-ts/runtime");
const runtime_3 = require("@protobuf-ts/runtime");
const runtime_4 = require("@protobuf-ts/runtime");
const runtime_5 = require("@protobuf-ts/runtime");
const budget_type_1 = require("../enums/budget_type");
const budget_period_1 = require("../enums/budget_period");
const budget_delivery_method_1 = require("../enums/budget_delivery_method");
const budget_status_1 = require("../enums/budget_status");
// @generated message type with reflection information, may provide speed optimized methods
class CampaignBudget$Type extends runtime_5.MessageType {
constructor() {
super("google.ads.googleads.v11.resources.CampaignBudget", [
{ no: 1, name: "resource_name", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["IMMUTABLE"], "google.api.resource_reference": { type: "googleads.googleapis.com/CampaignBudget" } } },
{ no: 19, name: "id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 20, name: "name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
{ no: 21, name: "amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 22, name: "total_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 6, name: "status", kind: "enum", T: () => ["google.ads.googleads.v11.enums.BudgetStatusEnum.BudgetStatus", budget_status_1.BudgetStatusEnum_BudgetStatus], options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 7, name: "delivery_method", kind: "enum", T: () => ["google.ads.googleads.v11.enums.BudgetDeliveryMethodEnum.BudgetDeliveryMethod", budget_delivery_method_1.BudgetDeliveryMethodEnum_BudgetDeliveryMethod] },
{ no: 23, name: "explicitly_shared", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ },
{ no: 24, name: "reference_count", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 25, name: "has_recommended_budget", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 26, name: "recommended_budget_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 13, name: "period", kind: "enum", T: () => ["google.ads.googleads.v11.enums.BudgetPeriodEnum.BudgetPeriod", budget_period_1.BudgetPeriodEnum_BudgetPeriod], options: { "google.api.field_behavior": ["IMMUTABLE"] } },
{ no: 27, name: "recommended_budget_estimated_change_weekly_clicks", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 28, name: "recommended_budget_estimated_change_weekly_cost_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 29, name: "recommended_budget_estimated_change_weekly_interactions", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 30, name: "recommended_budget_estimated_change_weekly_views", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } },
{ no: 18, name: "type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.BudgetTypeEnum.BudgetType", budget_type_1.BudgetTypeEnum_BudgetType], options: { "google.api.field_behavior": ["IMMUTABLE"] } }
], { "google.api.resource": { type: "googleads.googleapis.com/CampaignBudget", pattern: ["customers/{customer_id}/campaignBudgets/{campaign_budget_id}"] } });
}
create(value) {
const message = { resourceName: "", status: 0, deliveryMethod: 0, period: 0, type: 0 };
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
(0, runtime_3.reflectionMergePartial)(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string resource_name */ 1:
message.resourceName = reader.string();
break;
case /* optional int64 id */ 19:
message.id = reader.int64().toBigInt();
break;
case /* optional string name */ 20:
message.name = reader.string();
break;
case /* optional int64 amount_micros */ 21:
message.amountMicros = reader.int64().toBigInt();
break;
case /* optional int64 total_amount_micros */ 22:
message.totalAmountMicros = reader.int64().toBigInt();
break;
case /* google.ads.googleads.v11.enums.BudgetStatusEnum.BudgetStatus status */ 6:
message.status = reader.int32();
break;
case /* google.ads.googleads.v11.enums.BudgetDeliveryMethodEnum.BudgetDeliveryMethod delivery_method */ 7:
message.deliveryMethod = reader.int32();
break;
case /* optional bool explicitly_shared */ 23:
message.explicitlyShared = reader.bool();
break;
case /* optional int64 reference_count */ 24:
message.referenceCount = reader.int64().toBigInt();
break;
case /* optional bool has_recommended_budget */ 25:
message.hasRecommendedBudget = reader.bool();
break;
case /* optional int64 recommended_budget_amount_micros */ 26:
message.recommendedBudgetAmountMicros = reader.int64().toBigInt();
break;
case /* google.ads.googleads.v11.enums.BudgetPeriodEnum.BudgetPeriod period */ 13:
message.period = reader.int32();
break;
case /* optional int64 recommended_budget_estimated_change_weekly_clicks */ 27:
message.recommendedBudgetEstimatedChangeWeeklyClicks = reader.int64().toBigInt();
break;
case /* optional int64 recommended_budget_estimated_change_weekly_cost_micros */ 28:
message.recommendedBudgetEstimatedChangeWeeklyCostMicros = reader.int64().toBigInt();
break;
case /* optional int64 recommended_budget_estimated_change_weekly_interactions */ 29:
message.recommendedBudgetEstimatedChangeWeeklyInteractions = reader.int64().toBigInt();
break;
case /* optional int64 recommended_budget_estimated_change_weekly_views */ 30:
message.recommendedBudgetEstimatedChangeWeeklyViews = reader.int64().toBigInt();
break;
case /* google.ads.googleads.v11.enums.BudgetTypeEnum.BudgetType type */ 18:
message.type = reader.int32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* string resource_name = 1; */
if (message.resourceName !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.resourceName);
/* optional int64 id = 19; */
if (message.id !== undefined)
writer.tag(19, runtime_1.WireType.Varint).int64(message.id);
/* optional string name = 20; */
if (message.name !== undefined)
writer.tag(20, runtime_1.WireType.LengthDelimited).string(message.name);
/* optional int64 amount_micros = 21; */
if (message.amountMicros !== undefined)
writer.tag(21, runtime_1.WireType.Varint).int64(message.amountMicros);
/* optional int64 total_amount_micros = 22; */
if (message.totalAmountMicros !== undefined)
writer.tag(22, runtime_1.WireType.Varint).int64(message.totalAmountMicros);
/* google.ads.googleads.v11.enums.BudgetStatusEnum.BudgetStatus status = 6; */
if (message.status !== 0)
writer.tag(6, runtime_1.WireType.Varint).int32(message.status);
/* google.ads.googleads.v11.enums.BudgetDeliveryMethodEnum.BudgetDeliveryMethod delivery_method = 7; */
if (message.deliveryMethod !== 0)
writer.tag(7, runtime_1.WireType.Varint).int32(message.deliveryMethod);
/* optional bool explicitly_shared = 23; */
if (message.explicitlyShared !== undefined)
writer.tag(23, runtime_1.WireType.Varint).bool(message.explicitlyShared);
/* optional int64 reference_count = 24; */
if (message.referenceCount !== undefined)
writer.tag(24, runtime_1.WireType.Varint).int64(message.referenceCount);
/* optional bool has_recommended_budget = 25; */
if (message.hasRecommendedBudget !== undefined)
writer.tag(25, runtime_1.WireType.Varint).bool(message.hasRecommendedBudget);
/* optional int64 recommended_budget_amount_micros = 26; */
if (message.recommendedBudgetAmountMicros !== undefined)
writer.tag(26, runtime_1.WireType.Varint).int64(message.recommendedBudgetAmountMicros);
/* google.ads.googleads.v11.enums.BudgetPeriodEnum.BudgetPeriod period = 13; */
if (message.period !== 0)
writer.tag(13, runtime_1.WireType.Varint).int32(message.period);
/* optional int64 recommended_budget_estimated_change_weekly_clicks = 27; */
if (message.recommendedBudgetEstimatedChangeWeeklyClicks !== undefined)
writer.tag(27, runtime_1.WireType.Varint).int64(message.recommendedBudgetEstimatedChangeWeeklyClicks);
/* optional int64 recommended_budget_estimated_change_weekly_cost_micros = 28; */
if (message.recommendedBudgetEstimatedChangeWeeklyCostMicros !== undefined)
writer.tag(28, runtime_1.WireType.Varint).int64(message.recommendedBudgetEstimatedChangeWeeklyCostMicros);
/* optional int64 recommended_budget_estimated_change_weekly_interactions = 29; */
if (message.recommendedBudgetEstimatedChangeWeeklyInteractions !== undefined)
writer.tag(29, runtime_1.WireType.Varint).int64(message.recommendedBudgetEstimatedChangeWeeklyInteractions);
/* optional int64 recommended_budget_estimated_change_weekly_views = 30; */
if (message.recommendedBudgetEstimatedChangeWeeklyViews !== undefined)
writer.tag(30, runtime_1.WireType.Varint).int64(message.recommendedBudgetEstimatedChangeWeeklyViews);
/* google.ads.googleads.v11.enums.BudgetTypeEnum.BudgetType type = 18; */
if (message.type !== 0)
writer.tag(18, runtime_1.WireType.Varint).int32(message.type);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message google.ads.googleads.v11.resources.CampaignBudget
*/
exports.CampaignBudget = new CampaignBudget$Type();
//# sourceMappingURL=campaign_budget.js.map