UNPKG

google-ads-api-client

Version:

A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.

132 lines 9.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConversionValueRuleSet = 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 conversion_action_category_1 = require("../enums/conversion_action_category"); const conversion_value_rule_set_status_1 = require("../enums/conversion_value_rule_set_status"); const value_rule_set_attachment_type_1 = require("../enums/value_rule_set_attachment_type"); const value_rule_set_dimension_1 = require("../enums/value_rule_set_dimension"); // @generated message type with reflection information, may provide speed optimized methods class ConversionValueRuleSet$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.ConversionValueRuleSet", [ { 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/ConversionValueRuleSet" } } }, { no: 2, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 3, name: "conversion_value_rules", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.resource_reference": { type: "googleads.googleapis.com/ConversionValueRule" } } }, { no: 4, name: "dimensions", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["google.ads.googleads.v11.enums.ValueRuleSetDimensionEnum.ValueRuleSetDimension", value_rule_set_dimension_1.ValueRuleSetDimensionEnum_ValueRuleSetDimension] }, { no: 5, name: "owner_customer", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"], "google.api.resource_reference": { type: "googleads.googleapis.com/Customer" } } }, { no: 6, name: "attachment_type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.ValueRuleSetAttachmentTypeEnum.ValueRuleSetAttachmentType", value_rule_set_attachment_type_1.ValueRuleSetAttachmentTypeEnum_ValueRuleSetAttachmentType], options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 7, name: "campaign", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "google.api.resource_reference": { type: "googleads.googleapis.com/Campaign" } } }, { no: 8, name: "status", kind: "enum", T: () => ["google.ads.googleads.v11.enums.ConversionValueRuleSetStatusEnum.ConversionValueRuleSetStatus", conversion_value_rule_set_status_1.ConversionValueRuleSetStatusEnum_ConversionValueRuleSetStatus], options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 9, name: "conversion_action_categories", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["google.ads.googleads.v11.enums.ConversionActionCategoryEnum.ConversionActionCategory", conversion_action_category_1.ConversionActionCategoryEnum_ConversionActionCategory], options: { "google.api.field_behavior": ["IMMUTABLE"] } } ], { "google.api.resource": { type: "googleads.googleapis.com/ConversionValueRuleSet", pattern: ["customers/{customer_id}/conversionValueRuleSets/{conversion_value_rule_set_id}"] } }); } create(value) { const message = { resourceName: "", id: 0n, conversionValueRules: [], dimensions: [], ownerCustomer: "", attachmentType: 0, campaign: "", status: 0, conversionActionCategories: [] }; 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 /* int64 id */ 2: message.id = reader.int64().toBigInt(); break; case /* repeated string conversion_value_rules */ 3: message.conversionValueRules.push(reader.string()); break; case /* repeated google.ads.googleads.v11.enums.ValueRuleSetDimensionEnum.ValueRuleSetDimension dimensions */ 4: if (wireType === runtime_2.WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.dimensions.push(reader.int32()); else message.dimensions.push(reader.int32()); break; case /* string owner_customer */ 5: message.ownerCustomer = reader.string(); break; case /* google.ads.googleads.v11.enums.ValueRuleSetAttachmentTypeEnum.ValueRuleSetAttachmentType attachment_type */ 6: message.attachmentType = reader.int32(); break; case /* string campaign */ 7: message.campaign = reader.string(); break; case /* google.ads.googleads.v11.enums.ConversionValueRuleSetStatusEnum.ConversionValueRuleSetStatus status */ 8: message.status = reader.int32(); break; case /* repeated google.ads.googleads.v11.enums.ConversionActionCategoryEnum.ConversionActionCategory conversion_action_categories */ 9: if (wireType === runtime_2.WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.conversionActionCategories.push(reader.int32()); else message.conversionActionCategories.push(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_1.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_2.WireType.LengthDelimited).string(message.resourceName); /* int64 id = 2; */ if (message.id !== 0n) writer.tag(2, runtime_2.WireType.Varint).int64(message.id); /* repeated string conversion_value_rules = 3; */ for (let i = 0; i < message.conversionValueRules.length; i++) writer.tag(3, runtime_2.WireType.LengthDelimited).string(message.conversionValueRules[i]); /* repeated google.ads.googleads.v11.enums.ValueRuleSetDimensionEnum.ValueRuleSetDimension dimensions = 4; */ if (message.dimensions.length) { writer.tag(4, runtime_2.WireType.LengthDelimited).fork(); for (let i = 0; i < message.dimensions.length; i++) writer.int32(message.dimensions[i]); writer.join(); } /* string owner_customer = 5; */ if (message.ownerCustomer !== "") writer.tag(5, runtime_2.WireType.LengthDelimited).string(message.ownerCustomer); /* google.ads.googleads.v11.enums.ValueRuleSetAttachmentTypeEnum.ValueRuleSetAttachmentType attachment_type = 6; */ if (message.attachmentType !== 0) writer.tag(6, runtime_2.WireType.Varint).int32(message.attachmentType); /* string campaign = 7; */ if (message.campaign !== "") writer.tag(7, runtime_2.WireType.LengthDelimited).string(message.campaign); /* google.ads.googleads.v11.enums.ConversionValueRuleSetStatusEnum.ConversionValueRuleSetStatus status = 8; */ if (message.status !== 0) writer.tag(8, runtime_2.WireType.Varint).int32(message.status); /* repeated google.ads.googleads.v11.enums.ConversionActionCategoryEnum.ConversionActionCategory conversion_action_categories = 9; */ if (message.conversionActionCategories.length) { writer.tag(9, runtime_2.WireType.LengthDelimited).fork(); for (let i = 0; i < message.conversionActionCategories.length; i++) writer.int32(message.conversionActionCategories[i]); writer.join(); } let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_1.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message google.ads.googleads.v11.resources.ConversionValueRuleSet */ exports.ConversionValueRuleSet = new ConversionValueRuleSet$Type(); //# sourceMappingURL=conversion_value_rule_set.js.map