@google-analytics/data 7.1.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1577,7 +1577,7 @@
1577
1577
  "AlphaAnalyticsData": {
1578
1578
  "options": {
1579
1579
  "(google.api.default_host)": "analyticsdata.googleapis.com",
1580
- "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/analytics,https://www.googleapis.com/auth/analytics.readonly"
1580
+ "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/analytics,https://www.googleapis.com/auth/analytics.chatbot.read,https://www.googleapis.com/auth/analytics.readonly"
1581
1581
  },
1582
1582
  "methods": {
1583
1583
  "RunFunnelReport": {
@@ -1838,6 +1838,22 @@
1838
1838
  }
1839
1839
  ]
1840
1840
  },
1841
+ "Chat": {
1842
+ "requestType": "ChatRequest",
1843
+ "responseType": "ChatResponse",
1844
+ "options": {
1845
+ "(google.api.http).post": "/v1alpha/{property=properties/*}:chat",
1846
+ "(google.api.http).body": "*"
1847
+ },
1848
+ "parsedOptions": [
1849
+ {
1850
+ "(google.api.http)": {
1851
+ "post": "/v1alpha/{property=properties/*}:chat",
1852
+ "body": "*"
1853
+ }
1854
+ }
1855
+ ]
1856
+ },
1841
1857
  "RunReport": {
1842
1858
  "requestType": "RunReportRequest",
1843
1859
  "responseType": "RunReportResponse",
@@ -2913,6 +2929,64 @@
2913
2929
  }
2914
2930
  }
2915
2931
  },
2932
+ "ChatRequest": {
2933
+ "oneofs": {
2934
+ "_sessionId": {
2935
+ "oneof": [
2936
+ "sessionId"
2937
+ ]
2938
+ }
2939
+ },
2940
+ "fields": {
2941
+ "property": {
2942
+ "type": "string",
2943
+ "id": 1,
2944
+ "options": {
2945
+ "(google.api.field_behavior)": "REQUIRED",
2946
+ "(google.api.resource_reference).type": "analyticsadmin.googleapis.com/Property"
2947
+ }
2948
+ },
2949
+ "userQuery": {
2950
+ "type": "string",
2951
+ "id": 2,
2952
+ "options": {
2953
+ "(google.api.field_behavior)": "REQUIRED"
2954
+ }
2955
+ },
2956
+ "sessionId": {
2957
+ "type": "string",
2958
+ "id": 3,
2959
+ "options": {
2960
+ "(google.api.field_behavior)": "OPTIONAL",
2961
+ "proto3_optional": true
2962
+ }
2963
+ },
2964
+ "returnPropertyQuota": {
2965
+ "type": "bool",
2966
+ "id": 4,
2967
+ "options": {
2968
+ "(google.api.field_behavior)": "OPTIONAL"
2969
+ }
2970
+ }
2971
+ }
2972
+ },
2973
+ "ChatResponse": {
2974
+ "fields": {
2975
+ "sessionId": {
2976
+ "type": "string",
2977
+ "id": 1
2978
+ },
2979
+ "blocks": {
2980
+ "rule": "repeated",
2981
+ "type": "ResponseBlock",
2982
+ "id": 2
2983
+ },
2984
+ "propertyQuota": {
2985
+ "type": "PropertyChatQuota",
2986
+ "id": 3
2987
+ }
2988
+ }
2989
+ },
2916
2990
  "RunReportRequest": {
2917
2991
  "fields": {
2918
2992
  "property": {
@@ -3652,6 +3726,11 @@
3652
3726
  "section": {
3653
3727
  "type": "Section",
3654
3728
  "id": 10
3729
+ },
3730
+ "dataTruncationReasons": {
3731
+ "rule": "repeated",
3732
+ "type": "DataTruncationReason",
3733
+ "id": 11
3655
3734
  }
3656
3735
  },
3657
3736
  "nested": {
@@ -3688,6 +3767,100 @@
3688
3767
  }
3689
3768
  }
3690
3769
  }
3770
+ },
3771
+ "DataTruncationReason": {
3772
+ "oneofs": {
3773
+ "_dataTruncationType": {
3774
+ "oneof": [
3775
+ "dataTruncationType"
3776
+ ]
3777
+ },
3778
+ "_dataTruncationMessage": {
3779
+ "oneof": [
3780
+ "dataTruncationMessage"
3781
+ ]
3782
+ },
3783
+ "_dataTruncationDate": {
3784
+ "oneof": [
3785
+ "dataTruncationDate"
3786
+ ]
3787
+ }
3788
+ },
3789
+ "fields": {
3790
+ "dataTruncationType": {
3791
+ "type": "DataTruncationType",
3792
+ "id": 1,
3793
+ "options": {
3794
+ "proto3_optional": true
3795
+ }
3796
+ },
3797
+ "dataTruncationMessage": {
3798
+ "type": "string",
3799
+ "id": 2,
3800
+ "options": {
3801
+ "proto3_optional": true
3802
+ }
3803
+ },
3804
+ "dataTruncationDate": {
3805
+ "type": "string",
3806
+ "id": 3,
3807
+ "options": {
3808
+ "proto3_optional": true
3809
+ }
3810
+ },
3811
+ "dataTruncationDateRanges": {
3812
+ "rule": "repeated",
3813
+ "type": "DataTruncationDateRange",
3814
+ "id": 4
3815
+ }
3816
+ },
3817
+ "nested": {
3818
+ "DataTruncationType": {
3819
+ "values": {
3820
+ "DATA_TRUNCATION_TYPE_UNSPECIFIED": 0,
3821
+ "DATA_TRUNCATION_TYPE_RULES_BASED_MODELS": 1,
3822
+ "DATA_TRUNCATION_TYPE_DATA_DRIVEN_ATTRIBUTION": 2,
3823
+ "DATA_TRUNCATION_TYPE_DV360": 3,
3824
+ "DATA_TRUNCATION_TYPE_CM360": 4,
3825
+ "DATA_TRUNCATION_TYPE_ITEM_SCOPED_ECOMMERCE_METRICS": 5,
3826
+ "DATA_TRUNCATION_TYPE_EVENT_SCOPED_ECOMMERCE_METRICS": 6,
3827
+ "DATA_TRUNCATION_TYPE_DATE_RANGE": 7,
3828
+ "DATA_TRUNCATION_TYPE_PROPERTY": 8,
3829
+ "DATA_TRUNCATION_TYPE_CONVERSIONS": 9,
3830
+ "DATA_TRUNCATION_TYPE_GOOGLE_ADS": 10
3831
+ }
3832
+ },
3833
+ "DataTruncationDateRange": {
3834
+ "oneofs": {
3835
+ "_startDate": {
3836
+ "oneof": [
3837
+ "startDate"
3838
+ ]
3839
+ },
3840
+ "_endDate": {
3841
+ "oneof": [
3842
+ "endDate"
3843
+ ]
3844
+ }
3845
+ },
3846
+ "fields": {
3847
+ "startDate": {
3848
+ "type": "string",
3849
+ "id": 1,
3850
+ "options": {
3851
+ "proto3_optional": true
3852
+ }
3853
+ },
3854
+ "endDate": {
3855
+ "type": "string",
3856
+ "id": 2,
3857
+ "options": {
3858
+ "proto3_optional": true
3859
+ }
3860
+ }
3861
+ }
3862
+ }
3863
+ }
3691
3864
  }
3692
3865
  }
3693
3866
  },
@@ -3905,6 +4078,71 @@
3905
4078
  }
3906
4079
  }
3907
4080
  },
4081
+ "ResponseBlock": {
4082
+ "oneofs": {
4083
+ "block": {
4084
+ "oneof": [
4085
+ "text",
4086
+ "table"
4087
+ ]
4088
+ }
4089
+ },
4090
+ "fields": {
4091
+ "text": {
4092
+ "type": "string",
4093
+ "id": 1
4094
+ },
4095
+ "table": {
4096
+ "type": "DataTable",
4097
+ "id": 2
4098
+ }
4099
+ },
4100
+ "nested": {
4101
+ "DataTableCell": {
4102
+ "fields": {
4103
+ "value": {
4104
+ "type": "string",
4105
+ "id": 1
4106
+ }
4107
+ }
4108
+ },
4109
+ "DataTableHeader": {
4110
+ "fields": {
4111
+ "header": {
4112
+ "type": "string",
4113
+ "id": 1
4114
+ },
4115
+ "dataType": {
4116
+ "type": "string",
4117
+ "id": 2
4118
+ }
4119
+ }
4120
+ },
4121
+ "DataTableRow": {
4122
+ "fields": {
4123
+ "columns": {
4124
+ "rule": "repeated",
4125
+ "type": "DataTableCell",
4126
+ "id": 1
4127
+ }
4128
+ }
4129
+ },
4130
+ "DataTable": {
4131
+ "fields": {
4132
+ "headers": {
4133
+ "rule": "repeated",
4134
+ "type": "DataTableHeader",
4135
+ "id": 1
4136
+ },
4137
+ "rows": {
4138
+ "rule": "repeated",
4139
+ "type": "DataTableRow",
4140
+ "id": 2
4141
+ }
4142
+ }
4143
+ }
4144
+ }
4145
+ },
3908
4146
  "UserSegment": {
3909
4147
  "fields": {
3910
4148
  "userInclusionCriteria": {
@@ -4775,6 +5013,18 @@
4775
5013
  "id": 2
4776
5014
  }
4777
5015
  }
5016
+ },
5017
+ "PropertyChatQuota": {
5018
+ "fields": {
5019
+ "tokensPerDay": {
5020
+ "type": "QuotaStatus",
5021
+ "id": 1
5022
+ },
5023
+ "tokensPerHour": {
5024
+ "type": "QuotaStatus",
5025
+ "id": 2
5026
+ }
5027
+ }
4778
5028
  }
4779
5029
  }
4780
5030
  },
@@ -6322,6 +6572,11 @@
6322
6572
  "rule": "repeated",
6323
6573
  "type": "SamplingMetadata",
6324
6574
  "id": 9
6575
+ },
6576
+ "dataTruncationReasons": {
6577
+ "rule": "repeated",
6578
+ "type": "DataTruncationReason",
6579
+ "id": 10
6325
6580
  }
6326
6581
  },
6327
6582
  "nested": {
@@ -6358,6 +6613,100 @@
6358
6613
  }
6359
6614
  }
6360
6615
  }
6616
+ },
6617
+ "DataTruncationReason": {
6618
+ "oneofs": {
6619
+ "_dataTruncationType": {
6620
+ "oneof": [
6621
+ "dataTruncationType"
6622
+ ]
6623
+ },
6624
+ "_dataTruncationMessage": {
6625
+ "oneof": [
6626
+ "dataTruncationMessage"
6627
+ ]
6628
+ },
6629
+ "_dataTruncationDate": {
6630
+ "oneof": [
6631
+ "dataTruncationDate"
6632
+ ]
6633
+ }
6634
+ },
6635
+ "fields": {
6636
+ "dataTruncationType": {
6637
+ "type": "DataTruncationType",
6638
+ "id": 1,
6639
+ "options": {
6640
+ "proto3_optional": true
6641
+ }
6642
+ },
6643
+ "dataTruncationMessage": {
6644
+ "type": "string",
6645
+ "id": 2,
6646
+ "options": {
6647
+ "proto3_optional": true
6648
+ }
6649
+ },
6650
+ "dataTruncationDate": {
6651
+ "type": "string",
6652
+ "id": 3,
6653
+ "options": {
6654
+ "proto3_optional": true
6655
+ }
6656
+ },
6657
+ "dataTruncationDateRanges": {
6658
+ "rule": "repeated",
6659
+ "type": "DataTruncationDateRange",
6660
+ "id": 4
6661
+ }
6662
+ },
6663
+ "nested": {
6664
+ "DataTruncationType": {
6665
+ "values": {
6666
+ "DATA_TRUNCATION_TYPE_UNSPECIFIED": 0,
6667
+ "DATA_TRUNCATION_TYPE_RULES_BASED_MODELS": 1,
6668
+ "DATA_TRUNCATION_TYPE_DATA_DRIVEN_ATTRIBUTION": 2,
6669
+ "DATA_TRUNCATION_TYPE_DV360": 3,
6670
+ "DATA_TRUNCATION_TYPE_CM360": 4,
6671
+ "DATA_TRUNCATION_TYPE_ITEM_SCOPED_ECOMMERCE_METRICS": 5,
6672
+ "DATA_TRUNCATION_TYPE_EVENT_SCOPED_ECOMMERCE_METRICS": 6,
6673
+ "DATA_TRUNCATION_TYPE_DATE_RANGE": 7,
6674
+ "DATA_TRUNCATION_TYPE_PROPERTY": 8,
6675
+ "DATA_TRUNCATION_TYPE_CONVERSIONS": 9,
6676
+ "DATA_TRUNCATION_TYPE_GOOGLE_ADS": 10
6677
+ }
6678
+ },
6679
+ "DataTruncationDateRange": {
6680
+ "oneofs": {
6681
+ "_startDate": {
6682
+ "oneof": [
6683
+ "startDate"
6684
+ ]
6685
+ },
6686
+ "_endDate": {
6687
+ "oneof": [
6688
+ "endDate"
6689
+ ]
6690
+ }
6691
+ },
6692
+ "fields": {
6693
+ "startDate": {
6694
+ "type": "string",
6695
+ "id": 1,
6696
+ "options": {
6697
+ "proto3_optional": true
6698
+ }
6699
+ },
6700
+ "endDate": {
6701
+ "type": "string",
6702
+ "id": 2,
6703
+ "options": {
6704
+ "proto3_optional": true
6705
+ }
6706
+ }
6707
+ }
6708
+ }
6709
+ }
6361
6710
  }
6362
6711
  }
6363
6712
  },
@@ -493,6 +493,50 @@ export declare class AlphaAnalyticsDataClient {
493
493
  ]>;
494
494
  getReportTask(request: protos.google.analytics.data.v1alpha.IGetReportTaskRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1alpha.IReportTask, protos.google.analytics.data.v1alpha.IGetReportTaskRequest | null | undefined, {} | null | undefined>): void;
495
495
  getReportTask(request: protos.google.analytics.data.v1alpha.IGetReportTaskRequest, callback: Callback<protos.google.analytics.data.v1alpha.IReportTask, protos.google.analytics.data.v1alpha.IGetReportTaskRequest | null | undefined, {} | null | undefined>): void;
496
+ /**
497
+ * Provides a chat interface for interacting with Google Analytics data
498
+ * through the API.
499
+ *
500
+ * This product uses AI and may display inaccurate info. Your chat activity
501
+ * may be used to improve the product and your use is subject to Google's
502
+ * [Terms](https://policies.google.com/terms),
503
+ * [AI Use
504
+ * Policy](https://policies.google.com/terms/generative-ai/use-policy), and
505
+ * [Privacy Policy](https://policies.google.com/privacy).
506
+ * [Learn more about Chat AI
507
+ * Privacy](https://support.google.com/helpguide/answer/14185196).
508
+ *
509
+ * @param {Object} request
510
+ * The request object that will be sent.
511
+ * @param {string} request.property
512
+ * Required. The property to chat about.
513
+ * Format: properties/{property}
514
+ * @param {string} request.userQuery
515
+ * Required. The user's query.
516
+ * @param {string} [request.sessionId]
517
+ * Optional. Provide this session ID to continue an existing conversation
518
+ * and maintain context. If this field is empty or unset, a new chat
519
+ * session is created. Invalid session IDs will result in an error.
520
+ * @param {boolean} [request.returnPropertyQuota]
521
+ * Optional. If true, the response will include the current state of this
522
+ * Analytics Property's quota. Quota is returned in
523
+ * [PropertyChatQuota](#PropertyChatQuota).
524
+ * @param {object} [options]
525
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
526
+ * @returns {Promise} - The promise which resolves to an array.
527
+ * The first element of the array is an object representing {@link protos.google.analytics.data.v1alpha.ChatResponse|ChatResponse}.
528
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
529
+ * for more details and examples.
530
+ * @example <caption>include:samples/generated/v1alpha/alpha_analytics_data.chat.js</caption>
531
+ * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_Chat_async
532
+ */
533
+ chat(request?: protos.google.analytics.data.v1alpha.IChatRequest, options?: CallOptions): Promise<[
534
+ protos.google.analytics.data.v1alpha.IChatResponse,
535
+ protos.google.analytics.data.v1alpha.IChatRequest | undefined,
536
+ {} | undefined
537
+ ]>;
538
+ chat(request: protos.google.analytics.data.v1alpha.IChatRequest, options: CallOptions, callback: Callback<protos.google.analytics.data.v1alpha.IChatResponse, protos.google.analytics.data.v1alpha.IChatRequest | null | undefined, {} | null | undefined>): void;
539
+ chat(request: protos.google.analytics.data.v1alpha.IChatRequest, callback: Callback<protos.google.analytics.data.v1alpha.IChatResponse, protos.google.analytics.data.v1alpha.IChatRequest | null | undefined, {} | null | undefined>): void;
496
540
  /**
497
541
  * Returns a customized report of your Google Analytics event data. Reports
498
542
  * contain statistics derived from data collected by the Google Analytics
@@ -253,6 +253,7 @@ class AlphaAnalyticsDataClient {
253
253
  'queryReportTask',
254
254
  'getReportTask',
255
255
  'listReportTasks',
256
+ 'chat',
256
257
  'runReport',
257
258
  'getMetadata',
258
259
  ];
@@ -323,6 +324,7 @@ class AlphaAnalyticsDataClient {
323
324
  static get scopes() {
324
325
  return [
325
326
  'https://www.googleapis.com/auth/analytics',
327
+ 'https://www.googleapis.com/auth/analytics.chatbot.read',
326
328
  'https://www.googleapis.com/auth/analytics.readonly',
327
329
  ];
328
330
  }
@@ -681,6 +683,49 @@ class AlphaAnalyticsDataClient {
681
683
  throw error;
682
684
  });
683
685
  }
686
+ chat(request, optionsOrCallback, callback) {
687
+ request = request || {};
688
+ let options;
689
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
690
+ callback = optionsOrCallback;
691
+ options = {};
692
+ }
693
+ else {
694
+ options = optionsOrCallback;
695
+ }
696
+ options = options || {};
697
+ options.otherArgs = options.otherArgs || {};
698
+ options.otherArgs.headers = options.otherArgs.headers || {};
699
+ options.otherArgs.headers['x-goog-request-params'] =
700
+ this._gaxModule.routingHeader.fromParams({
701
+ property: request.property ?? '',
702
+ });
703
+ this.initialize().catch(err => {
704
+ throw err;
705
+ });
706
+ this._log.info('chat request %j', request);
707
+ const wrappedCallback = callback
708
+ ? (error, response, options, rawResponse) => {
709
+ this._log.info('chat response %j', response);
710
+ callback(error, response, options, rawResponse); // We verified callback above.
711
+ }
712
+ : undefined;
713
+ return this.innerApiCalls
714
+ .chat(request, options, wrappedCallback)
715
+ ?.then(([response, options, rawResponse]) => {
716
+ this._log.info('chat response %j', response);
717
+ return [response, options, rawResponse];
718
+ })
719
+ .catch((error) => {
720
+ if (error &&
721
+ 'statusDetails' in error &&
722
+ error.statusDetails instanceof Array) {
723
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
724
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
725
+ }
726
+ throw error;
727
+ });
728
+ }
684
729
  runReport(request, optionsOrCallback, callback) {
685
730
  request = request || {};
686
731
  let options;
@@ -97,6 +97,11 @@
97
97
  "retry_codes_name": "unknown",
98
98
  "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
99
99
  },
100
+ "Chat": {
101
+ "timeout_millis": 60000,
102
+ "retry_codes_name": "unknown",
103
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
104
+ },
100
105
  "RunReport": {
101
106
  "timeout_millis": 60000,
102
107
  "retry_codes_name": "unknown",
@@ -50,6 +50,11 @@
50
50
  "getReportTask"
51
51
  ]
52
52
  },
53
+ "Chat": {
54
+ "methods": [
55
+ "chat"
56
+ ]
57
+ },
53
58
  "RunReport": {
54
59
  "methods": [
55
60
  "runReport"
@@ -136,6 +141,11 @@
136
141
  "getReportTask"
137
142
  ]
138
143
  },
144
+ "Chat": {
145
+ "methods": [
146
+ "chat"
147
+ ]
148
+ },
139
149
  "RunReport": {
140
150
  "methods": [
141
151
  "runReport"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-analytics/data",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Data client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",