From 96bb1b51a7d1481cb16d2d9ca6bc984b3258688d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:20:12 -0700 Subject: [PATCH] feat: [analytics-data] add `SamplingLevel` type to Data API v1alpha (#5759) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add `SamplingLevel` type to Data API v1alpha feat: add `sampling_level` to the `ReportDefinition` type PiperOrigin-RevId: 686560382 Source-Link: https://github.com/googleapis/googleapis/commit/7b6975c4bb1f02bb05fd94cb6f8614f08fb55d24 Source-Link: https://github.com/googleapis/googleapis-gen/commit/52607af0302837ce880471a94e473deab5ca0e4f Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiI1MjYwN2FmMDMwMjgzN2NlODgwNDcxYTk0ZTQ3M2RlYWI1Y2EwZTRmIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- .../data/v1alpha/analytics_data_api.proto | 4 + .../google/analytics/data/v1alpha/data.proto | 20 +++++ .../google-analytics-data/protos/protos.d.ts | 17 ++++ .../google-analytics-data/protos/protos.js | 89 +++++++++++++++++++ .../google-analytics-data/protos/protos.json | 23 +++++ 5 files changed, 153 insertions(+) diff --git a/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto b/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto index 3b2c2b0a989..0b00c65a573 100644 --- a/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto +++ b/packages/google-analytics-data/protos/google/analytics/data/v1alpha/analytics_data_api.proto @@ -1086,6 +1086,10 @@ message ReportTask { // the `eventName` dimension and `eventCount` metric will not have a row // containing eventName: "purchase" and eventCount: 0. bool keep_empty_rows = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The report's sampling level. + optional SamplingLevel sampling_level = 14 + [(google.api.field_behavior) = OPTIONAL]; } // The report metadata for a specific report task. diff --git a/packages/google-analytics-data/protos/google/analytics/data/v1alpha/data.proto b/packages/google-analytics-data/protos/google/analytics/data/v1alpha/data.proto index 59612d66621..1ec409c3ca8 100644 --- a/packages/google-analytics-data/protos/google/analytics/data/v1alpha/data.proto +++ b/packages/google-analytics-data/protos/google/analytics/data/v1alpha/data.proto @@ -1573,3 +1573,23 @@ enum RestrictedMetricType { // Revenue metrics such as `purchaseRevenue`. REVENUE_DATA = 2; } + +// Categories of sampling levels for the requests. +enum SamplingLevel { + // Unspecified type. + SAMPLING_LEVEL_UNSPECIFIED = 0; + + // Applies a sampling level of 10 million to standard properties and + // 100 million to Google Analytics 360 properties. + LOW = 1; + + // Exclusive to Google Analytics 360 properties with a sampling level of 1 + // billion. + MEDIUM = 2; + + // Exclusive to Google Analytics 360 properties. Unsampled explorations are + // more accurate and can reveal insights that aren't visible in standard + // explorations. To learn more, see + // https://support.google.com/analytics/answer/10896953. + UNSAMPLED = 3; +} diff --git a/packages/google-analytics-data/protos/protos.d.ts b/packages/google-analytics-data/protos/protos.d.ts index cd577c91e2c..ca36df03e34 100644 --- a/packages/google-analytics-data/protos/protos.d.ts +++ b/packages/google-analytics-data/protos/protos.d.ts @@ -7608,6 +7608,9 @@ export namespace google { /** ReportDefinition keepEmptyRows */ keepEmptyRows?: (boolean|null); + + /** ReportDefinition samplingLevel */ + samplingLevel?: (google.analytics.data.v1alpha.SamplingLevel|keyof typeof google.analytics.data.v1alpha.SamplingLevel|null); } /** Represents a ReportDefinition. */ @@ -7655,6 +7658,12 @@ export namespace google { /** ReportDefinition keepEmptyRows. */ public keepEmptyRows: boolean; + /** ReportDefinition samplingLevel. */ + public samplingLevel?: (google.analytics.data.v1alpha.SamplingLevel|keyof typeof google.analytics.data.v1alpha.SamplingLevel|null); + + /** ReportDefinition _samplingLevel. */ + public _samplingLevel?: "samplingLevel"; + /** * Creates a new ReportDefinition instance using the specified properties. * @param [properties] Properties to set @@ -16209,6 +16218,14 @@ export namespace google { COST_DATA = 1, REVENUE_DATA = 2 } + + /** SamplingLevel enum. */ + enum SamplingLevel { + SAMPLING_LEVEL_UNSPECIFIED = 0, + LOW = 1, + MEDIUM = 2, + UNSAMPLED = 3 + } } /** Namespace v1beta. */ diff --git a/packages/google-analytics-data/protos/protos.js b/packages/google-analytics-data/protos/protos.js index 2b6fd0ee0fe..497b2eb33c3 100644 --- a/packages/google-analytics-data/protos/protos.js +++ b/packages/google-analytics-data/protos/protos.js @@ -20326,6 +20326,7 @@ * @property {string|null} [currencyCode] ReportDefinition currencyCode * @property {google.analytics.data.v1alpha.ICohortSpec|null} [cohortSpec] ReportDefinition cohortSpec * @property {boolean|null} [keepEmptyRows] ReportDefinition keepEmptyRows + * @property {google.analytics.data.v1alpha.SamplingLevel|null} [samplingLevel] ReportDefinition samplingLevel */ /** @@ -20444,6 +20445,28 @@ */ ReportDefinition.prototype.keepEmptyRows = false; + /** + * ReportDefinition samplingLevel. + * @member {google.analytics.data.v1alpha.SamplingLevel|null|undefined} samplingLevel + * @memberof google.analytics.data.v1alpha.ReportTask.ReportDefinition + * @instance + */ + ReportDefinition.prototype.samplingLevel = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReportDefinition _samplingLevel. + * @member {"samplingLevel"|undefined} _samplingLevel + * @memberof google.analytics.data.v1alpha.ReportTask.ReportDefinition + * @instance + */ + Object.defineProperty(ReportDefinition.prototype, "_samplingLevel", { + get: $util.oneOfGetter($oneOfFields = ["samplingLevel"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new ReportDefinition instance using the specified properties. * @function create @@ -20500,6 +20523,8 @@ $root.google.analytics.data.v1alpha.CohortSpec.encode(message.cohortSpec, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.keepEmptyRows != null && Object.hasOwnProperty.call(message, "keepEmptyRows")) writer.uint32(/* id 13, wireType 0 =*/104).bool(message.keepEmptyRows); + if (message.samplingLevel != null && Object.hasOwnProperty.call(message, "samplingLevel")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.samplingLevel); return writer; }; @@ -20597,6 +20622,10 @@ message.keepEmptyRows = reader.bool(); break; } + case 14: { + message.samplingLevel = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -20632,6 +20661,7 @@ ReportDefinition.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.dimensions != null && message.hasOwnProperty("dimensions")) { if (!Array.isArray(message.dimensions)) return "dimensions: array expected"; @@ -20710,6 +20740,18 @@ if (message.keepEmptyRows != null && message.hasOwnProperty("keepEmptyRows")) if (typeof message.keepEmptyRows !== "boolean") return "keepEmptyRows: boolean expected"; + if (message.samplingLevel != null && message.hasOwnProperty("samplingLevel")) { + properties._samplingLevel = 1; + switch (message.samplingLevel) { + default: + return "samplingLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } return null; }; @@ -20835,6 +20877,30 @@ } if (object.keepEmptyRows != null) message.keepEmptyRows = Boolean(object.keepEmptyRows); + switch (object.samplingLevel) { + default: + if (typeof object.samplingLevel === "number") { + message.samplingLevel = object.samplingLevel; + break; + } + break; + case "SAMPLING_LEVEL_UNSPECIFIED": + case 0: + message.samplingLevel = 0; + break; + case "LOW": + case 1: + message.samplingLevel = 1; + break; + case "MEDIUM": + case 2: + message.samplingLevel = 2; + break; + case "UNSAMPLED": + case 3: + message.samplingLevel = 3; + break; + } return message; }; @@ -20920,6 +20986,11 @@ object.cohortSpec = $root.google.analytics.data.v1alpha.CohortSpec.toObject(message.cohortSpec, options); if (message.keepEmptyRows != null && message.hasOwnProperty("keepEmptyRows")) object.keepEmptyRows = message.keepEmptyRows; + if (message.samplingLevel != null && message.hasOwnProperty("samplingLevel")) { + object.samplingLevel = options.enums === String ? $root.google.analytics.data.v1alpha.SamplingLevel[message.samplingLevel] === undefined ? message.samplingLevel : $root.google.analytics.data.v1alpha.SamplingLevel[message.samplingLevel] : message.samplingLevel; + if (options.oneofs) + object._samplingLevel = "samplingLevel"; + } return object; }; @@ -42328,6 +42399,24 @@ return values; })(); + /** + * SamplingLevel enum. + * @name google.analytics.data.v1alpha.SamplingLevel + * @enum {number} + * @property {number} SAMPLING_LEVEL_UNSPECIFIED=0 SAMPLING_LEVEL_UNSPECIFIED value + * @property {number} LOW=1 LOW value + * @property {number} MEDIUM=2 MEDIUM value + * @property {number} UNSAMPLED=3 UNSAMPLED value + */ + v1alpha.SamplingLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SAMPLING_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOW"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + values[valuesById[3] = "UNSAMPLED"] = 3; + return values; + })(); + return v1alpha; })(); diff --git a/packages/google-analytics-data/protos/protos.json b/packages/google-analytics-data/protos/protos.json index 018d2222f00..a3c8a9b4db3 100644 --- a/packages/google-analytics-data/protos/protos.json +++ b/packages/google-analytics-data/protos/protos.json @@ -2393,6 +2393,13 @@ }, "nested": { "ReportDefinition": { + "oneofs": { + "_samplingLevel": { + "oneof": [ + "samplingLevel" + ] + } + }, "fields": { "dimensions": { "rule": "repeated", @@ -2482,6 +2489,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "samplingLevel": { + "type": "SamplingLevel", + "id": 14, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } } } }, @@ -4153,6 +4168,14 @@ "COST_DATA": 1, "REVENUE_DATA": 2 } + }, + "SamplingLevel": { + "values": { + "SAMPLING_LEVEL_UNSPECIFIED": 0, + "LOW": 1, + "MEDIUM": 2, + "UNSAMPLED": 3 + } } } },