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.

315 lines 22.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Invoice_AccountBudgetSummary = exports.Invoice = 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 dates_1 = require("../common/dates"); const invoice_type_1 = require("../enums/invoice_type"); // @generated message type with reflection information, may provide speed optimized methods class Invoice$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.Invoice", [ { no: 1, name: "resource_name", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"], "google.api.resource_reference": { type: "googleads.googleapis.com/Invoice" } } }, { no: 25, name: "id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 3, name: "type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.InvoiceTypeEnum.InvoiceType", invoice_type_1.InvoiceTypeEnum_InvoiceType], options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 26, name: "billing_setup", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 27, name: "payments_account_id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 28, name: "payments_profile_id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 29, name: "issue_date", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 30, name: "due_date", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 9, name: "service_date_range", kind: "message", T: () => dates_1.DateRange, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 31, name: "currency_code", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 19, name: "adjustments_subtotal_amount_micros", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 20, name: "adjustments_tax_amount_micros", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 21, name: "adjustments_total_amount_micros", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 22, name: "regulatory_costs_subtotal_amount_micros", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 23, name: "regulatory_costs_tax_amount_micros", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 24, name: "regulatory_costs_total_amount_micros", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 33, name: "subtotal_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 34, name: "tax_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 35, name: "total_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 36, name: "corrected_invoice", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 37, name: "replaced_invoices", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 38, name: "pdf_url", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 18, name: "account_budget_summaries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.Invoice_AccountBudgetSummary, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } } ], { "google.api.resource": { type: "googleads.googleapis.com/Invoice", pattern: ["customers/{customer_id}/invoices/{invoice_id}"] } }); } create(value) { const message = { resourceName: "", type: 0, adjustmentsSubtotalAmountMicros: 0n, adjustmentsTaxAmountMicros: 0n, adjustmentsTotalAmountMicros: 0n, regulatoryCostsSubtotalAmountMicros: 0n, regulatoryCostsTaxAmountMicros: 0n, regulatoryCostsTotalAmountMicros: 0n, replacedInvoices: [], accountBudgetSummaries: [] }; 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 string id */ 25: message.id = reader.string(); break; case /* google.ads.googleads.v11.enums.InvoiceTypeEnum.InvoiceType type */ 3: message.type = reader.int32(); break; case /* optional string billing_setup */ 26: message.billingSetup = reader.string(); break; case /* optional string payments_account_id */ 27: message.paymentsAccountId = reader.string(); break; case /* optional string payments_profile_id */ 28: message.paymentsProfileId = reader.string(); break; case /* optional string issue_date */ 29: message.issueDate = reader.string(); break; case /* optional string due_date */ 30: message.dueDate = reader.string(); break; case /* google.ads.googleads.v11.common.DateRange service_date_range */ 9: message.serviceDateRange = dates_1.DateRange.internalBinaryRead(reader, reader.uint32(), options, message.serviceDateRange); break; case /* optional string currency_code */ 31: message.currencyCode = reader.string(); break; case /* int64 adjustments_subtotal_amount_micros */ 19: message.adjustmentsSubtotalAmountMicros = reader.int64().toBigInt(); break; case /* int64 adjustments_tax_amount_micros */ 20: message.adjustmentsTaxAmountMicros = reader.int64().toBigInt(); break; case /* int64 adjustments_total_amount_micros */ 21: message.adjustmentsTotalAmountMicros = reader.int64().toBigInt(); break; case /* int64 regulatory_costs_subtotal_amount_micros */ 22: message.regulatoryCostsSubtotalAmountMicros = reader.int64().toBigInt(); break; case /* int64 regulatory_costs_tax_amount_micros */ 23: message.regulatoryCostsTaxAmountMicros = reader.int64().toBigInt(); break; case /* int64 regulatory_costs_total_amount_micros */ 24: message.regulatoryCostsTotalAmountMicros = reader.int64().toBigInt(); break; case /* optional int64 subtotal_amount_micros */ 33: message.subtotalAmountMicros = reader.int64().toBigInt(); break; case /* optional int64 tax_amount_micros */ 34: message.taxAmountMicros = reader.int64().toBigInt(); break; case /* optional int64 total_amount_micros */ 35: message.totalAmountMicros = reader.int64().toBigInt(); break; case /* optional string corrected_invoice */ 36: message.correctedInvoice = reader.string(); break; case /* repeated string replaced_invoices */ 37: message.replacedInvoices.push(reader.string()); break; case /* optional string pdf_url */ 38: message.pdfUrl = reader.string(); break; case /* repeated google.ads.googleads.v11.resources.Invoice.AccountBudgetSummary account_budget_summaries */ 18: message.accountBudgetSummaries.push(exports.Invoice_AccountBudgetSummary.internalBinaryRead(reader, reader.uint32(), options)); 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 string id = 25; */ if (message.id !== undefined) writer.tag(25, runtime_1.WireType.LengthDelimited).string(message.id); /* google.ads.googleads.v11.enums.InvoiceTypeEnum.InvoiceType type = 3; */ if (message.type !== 0) writer.tag(3, runtime_1.WireType.Varint).int32(message.type); /* optional string billing_setup = 26; */ if (message.billingSetup !== undefined) writer.tag(26, runtime_1.WireType.LengthDelimited).string(message.billingSetup); /* optional string payments_account_id = 27; */ if (message.paymentsAccountId !== undefined) writer.tag(27, runtime_1.WireType.LengthDelimited).string(message.paymentsAccountId); /* optional string payments_profile_id = 28; */ if (message.paymentsProfileId !== undefined) writer.tag(28, runtime_1.WireType.LengthDelimited).string(message.paymentsProfileId); /* optional string issue_date = 29; */ if (message.issueDate !== undefined) writer.tag(29, runtime_1.WireType.LengthDelimited).string(message.issueDate); /* optional string due_date = 30; */ if (message.dueDate !== undefined) writer.tag(30, runtime_1.WireType.LengthDelimited).string(message.dueDate); /* google.ads.googleads.v11.common.DateRange service_date_range = 9; */ if (message.serviceDateRange) dates_1.DateRange.internalBinaryWrite(message.serviceDateRange, writer.tag(9, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* optional string currency_code = 31; */ if (message.currencyCode !== undefined) writer.tag(31, runtime_1.WireType.LengthDelimited).string(message.currencyCode); /* int64 adjustments_subtotal_amount_micros = 19; */ if (message.adjustmentsSubtotalAmountMicros !== 0n) writer.tag(19, runtime_1.WireType.Varint).int64(message.adjustmentsSubtotalAmountMicros); /* int64 adjustments_tax_amount_micros = 20; */ if (message.adjustmentsTaxAmountMicros !== 0n) writer.tag(20, runtime_1.WireType.Varint).int64(message.adjustmentsTaxAmountMicros); /* int64 adjustments_total_amount_micros = 21; */ if (message.adjustmentsTotalAmountMicros !== 0n) writer.tag(21, runtime_1.WireType.Varint).int64(message.adjustmentsTotalAmountMicros); /* int64 regulatory_costs_subtotal_amount_micros = 22; */ if (message.regulatoryCostsSubtotalAmountMicros !== 0n) writer.tag(22, runtime_1.WireType.Varint).int64(message.regulatoryCostsSubtotalAmountMicros); /* int64 regulatory_costs_tax_amount_micros = 23; */ if (message.regulatoryCostsTaxAmountMicros !== 0n) writer.tag(23, runtime_1.WireType.Varint).int64(message.regulatoryCostsTaxAmountMicros); /* int64 regulatory_costs_total_amount_micros = 24; */ if (message.regulatoryCostsTotalAmountMicros !== 0n) writer.tag(24, runtime_1.WireType.Varint).int64(message.regulatoryCostsTotalAmountMicros); /* optional int64 subtotal_amount_micros = 33; */ if (message.subtotalAmountMicros !== undefined) writer.tag(33, runtime_1.WireType.Varint).int64(message.subtotalAmountMicros); /* optional int64 tax_amount_micros = 34; */ if (message.taxAmountMicros !== undefined) writer.tag(34, runtime_1.WireType.Varint).int64(message.taxAmountMicros); /* optional int64 total_amount_micros = 35; */ if (message.totalAmountMicros !== undefined) writer.tag(35, runtime_1.WireType.Varint).int64(message.totalAmountMicros); /* optional string corrected_invoice = 36; */ if (message.correctedInvoice !== undefined) writer.tag(36, runtime_1.WireType.LengthDelimited).string(message.correctedInvoice); /* repeated string replaced_invoices = 37; */ for (let i = 0; i < message.replacedInvoices.length; i++) writer.tag(37, runtime_1.WireType.LengthDelimited).string(message.replacedInvoices[i]); /* optional string pdf_url = 38; */ if (message.pdfUrl !== undefined) writer.tag(38, runtime_1.WireType.LengthDelimited).string(message.pdfUrl); /* repeated google.ads.googleads.v11.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18; */ for (let i = 0; i < message.accountBudgetSummaries.length; i++) exports.Invoice_AccountBudgetSummary.internalBinaryWrite(message.accountBudgetSummaries[i], writer.tag(18, runtime_1.WireType.LengthDelimited).fork(), options).join(); 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.Invoice */ exports.Invoice = new Invoice$Type(); // @generated message type with reflection information, may provide speed optimized methods class Invoice_AccountBudgetSummary$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.Invoice.AccountBudgetSummary", [ { no: 10, name: "customer", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 11, name: "customer_descriptive_name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 12, name: "account_budget", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 13, name: "account_budget_name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 14, name: "purchase_order_number", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 15, name: "subtotal_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 16, name: "tax_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 17, name: "total_amount_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 9, name: "billable_activity_date_range", kind: "message", T: () => dates_1.DateRange, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } } ]); } create(value) { const message = {}; 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 /* optional string customer */ 10: message.customer = reader.string(); break; case /* optional string customer_descriptive_name */ 11: message.customerDescriptiveName = reader.string(); break; case /* optional string account_budget */ 12: message.accountBudget = reader.string(); break; case /* optional string account_budget_name */ 13: message.accountBudgetName = reader.string(); break; case /* optional string purchase_order_number */ 14: message.purchaseOrderNumber = reader.string(); break; case /* optional int64 subtotal_amount_micros */ 15: message.subtotalAmountMicros = reader.int64().toBigInt(); break; case /* optional int64 tax_amount_micros */ 16: message.taxAmountMicros = reader.int64().toBigInt(); break; case /* optional int64 total_amount_micros */ 17: message.totalAmountMicros = reader.int64().toBigInt(); break; case /* google.ads.googleads.v11.common.DateRange billable_activity_date_range */ 9: message.billableActivityDateRange = dates_1.DateRange.internalBinaryRead(reader, reader.uint32(), options, message.billableActivityDateRange); 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) { /* optional string customer = 10; */ if (message.customer !== undefined) writer.tag(10, runtime_1.WireType.LengthDelimited).string(message.customer); /* optional string customer_descriptive_name = 11; */ if (message.customerDescriptiveName !== undefined) writer.tag(11, runtime_1.WireType.LengthDelimited).string(message.customerDescriptiveName); /* optional string account_budget = 12; */ if (message.accountBudget !== undefined) writer.tag(12, runtime_1.WireType.LengthDelimited).string(message.accountBudget); /* optional string account_budget_name = 13; */ if (message.accountBudgetName !== undefined) writer.tag(13, runtime_1.WireType.LengthDelimited).string(message.accountBudgetName); /* optional string purchase_order_number = 14; */ if (message.purchaseOrderNumber !== undefined) writer.tag(14, runtime_1.WireType.LengthDelimited).string(message.purchaseOrderNumber); /* optional int64 subtotal_amount_micros = 15; */ if (message.subtotalAmountMicros !== undefined) writer.tag(15, runtime_1.WireType.Varint).int64(message.subtotalAmountMicros); /* optional int64 tax_amount_micros = 16; */ if (message.taxAmountMicros !== undefined) writer.tag(16, runtime_1.WireType.Varint).int64(message.taxAmountMicros); /* optional int64 total_amount_micros = 17; */ if (message.totalAmountMicros !== undefined) writer.tag(17, runtime_1.WireType.Varint).int64(message.totalAmountMicros); /* google.ads.googleads.v11.common.DateRange billable_activity_date_range = 9; */ if (message.billableActivityDateRange) dates_1.DateRange.internalBinaryWrite(message.billableActivityDateRange, writer.tag(9, runtime_1.WireType.LengthDelimited).fork(), options).join(); 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.Invoice.AccountBudgetSummary */ exports.Invoice_AccountBudgetSummary = new Invoice_AccountBudgetSummary$Type(); //# sourceMappingURL=invoice.js.map