From db562392998276e5a60698baef08025caadc68ce Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:29:28 -0700 Subject: [PATCH] feat: add `GetKeyEvent`, `CreateKeyEvent`, `ListKeyEvents`, `UpdateKeyEvent`, `DeleteKeyEvent` methods to the Admin API v1beta (#7533) feat: mark `GetConversionEvent`, `CreateConversionEvent`, `ListConversionEvents`, `UpdateConversionEvent`, `DeleteConversionEvent` methods as deprecated in the Admin API v1beta feat: add the `default_conversion_value` field to the `ConversionEvent` resource in the Admin API v1beta feat: add the `include_all_users` and `expand_groups` fields to the `RunAccessReportRequest` resource in the Admin API v1beta feat: add the `gmp_organization` field to the `Account` resource in the Admin API v1beta chore: update go_package to match open source code docs: change comment for methods `DeleteAccount`, `DeleteProperty`, and `RunAccessReport` in service `AnalyticsAdminService` docs: change comment in fields `account` and `property` in message `SearchChangeHistoryEventsRequest` docs: change comment for field `property_type` in message `Property` PiperOrigin-RevId: 653218190 Source-Link: https://github.com/googleapis/googleapis/commit/b05173cc3d54034cc3a021d130fe1ca4aef18066 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b2881b674e0006525e37a1668941523c0f7fd919 Copy-Tag: eyJwIjoiQW5hbHl0aWNzQWRtaW4vLk93bEJvdC55YW1sIiwiaCI6ImIyODgxYjY3NGUwMDA2NTI1ZTM3YTE2Njg5NDE1MjNjMGY3ZmQ5MTkifQ== Co-authored-by: Brent Shaffer --- .../metadata/V1Beta/AccessReport.php | Bin 3919 -> 3914 bytes .../metadata/V1Beta/AnalyticsAdmin.php | 52 ++- AnalyticsAdmin/metadata/V1Beta/Resources.php | Bin 9580 -> 10593 bytes .../create_conversion_event.php | 1 + .../create_firebase_link.php | 3 +- .../create_key_event.php | 79 ++++ .../delete_account.php | 2 +- .../delete_conversion_event.php | 1 + .../delete_firebase_link.php | 3 +- .../delete_key_event.php | 71 ++++ .../delete_property.php | 2 +- .../get_conversion_event.php | 1 + .../get_data_sharing_settings.php | 3 +- .../get_key_event.php | 73 ++++ .../list_conversion_events.php | 1 + .../list_firebase_links.php | 3 +- .../list_key_events.php | 78 ++++ .../run_access_report.php | 6 +- .../search_change_history_events.php | 6 +- .../update_conversion_event.php | 1 + .../update_key_event.php | 77 ++++ AnalyticsAdmin/src/V1beta/Account.php | 42 ++ .../Client/AnalyticsAdminServiceClient.php | 213 +++++++++- AnalyticsAdmin/src/V1beta/ConversionEvent.php | 44 ++ .../DefaultConversionValue.php | 141 +++++++ .../src/V1beta/CreateFirebaseLinkRequest.php | 11 +- .../src/V1beta/CreateKeyEventRequest.php | 132 ++++++ .../src/V1beta/DeleteFirebaseLinkRequest.php | 11 +- .../src/V1beta/DeleteKeyEventRequest.php | 91 +++++ .../AnalyticsAdminServiceGapicClient.php | 381 +++++++++++++++++- .../V1beta/GetDataSharingSettingsRequest.php | 11 +- .../src/V1beta/GetKeyEventRequest.php | 91 +++++ AnalyticsAdmin/src/V1beta/KeyEvent.php | 323 +++++++++++++++ .../src/V1beta/KeyEvent/CountingMethod.php | 66 +++ .../src/V1beta/KeyEvent/DefaultValue.php | 124 ++++++ .../src/V1beta/ListFirebaseLinksRequest.php | 11 +- .../src/V1beta/ListKeyEventsRequest.php | 174 ++++++++ .../src/V1beta/ListKeyEventsResponse.php | 105 +++++ AnalyticsAdmin/src/V1beta/Property.php | 12 +- .../src/V1beta/RunAccessReportRequest.php | 96 +++++ .../SearchChangeHistoryEventsRequest.php | 20 +- .../src/V1beta/UpdateKeyEventRequest.php | 156 +++++++ AnalyticsAdmin/src/V1beta/gapic_metadata.json | 25 ++ ...analytics_admin_service_client_config.json | 25 ++ ...lytics_admin_service_descriptor_config.php | 71 ++++ ...ytics_admin_service_rest_client_config.php | 61 +++ .../AnalyticsAdminServiceClientTest.php | 346 ++++++++++++++++ .../AnalyticsAdminServiceClientTest.php | 375 +++++++++++++++++ 48 files changed, 3554 insertions(+), 67 deletions(-) create mode 100644 AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/create_key_event.php create mode 100644 AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_key_event.php create mode 100644 AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_key_event.php create mode 100644 AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_key_events.php create mode 100644 AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_key_event.php create mode 100644 AnalyticsAdmin/src/V1beta/ConversionEvent/DefaultConversionValue.php create mode 100644 AnalyticsAdmin/src/V1beta/CreateKeyEventRequest.php create mode 100644 AnalyticsAdmin/src/V1beta/DeleteKeyEventRequest.php create mode 100644 AnalyticsAdmin/src/V1beta/GetKeyEventRequest.php create mode 100644 AnalyticsAdmin/src/V1beta/KeyEvent.php create mode 100644 AnalyticsAdmin/src/V1beta/KeyEvent/CountingMethod.php create mode 100644 AnalyticsAdmin/src/V1beta/KeyEvent/DefaultValue.php create mode 100644 AnalyticsAdmin/src/V1beta/ListKeyEventsRequest.php create mode 100644 AnalyticsAdmin/src/V1beta/ListKeyEventsResponse.php create mode 100644 AnalyticsAdmin/src/V1beta/UpdateKeyEventRequest.php diff --git a/AnalyticsAdmin/metadata/V1Beta/AccessReport.php b/AnalyticsAdmin/metadata/V1Beta/AccessReport.php index bc7f58527609d07206bda550081c5be34c976325..46280e17b9d21fdb8d6be09b8e6c99bb1506605c 100644 GIT binary patch delta 96 zcmX>vcS>%Zpp1Tc szJ6j}VoqgAW^%E9VoGjio_=CMW|?79YDpr5Uyx)C7B5Je%*5{t0NM~EeElcV2G8J4VKto8L1|<6*1eQcTXzojj3CZt_Y#F*T?3{QUHsRK4{4oW#6zz5Jqd i{q)qlf};GAe0_*iVnJr{#6WR2>%^4Y%)H5e`FsHmWFHX# diff --git a/AnalyticsAdmin/metadata/V1Beta/AnalyticsAdmin.php b/AnalyticsAdmin/metadata/V1Beta/AnalyticsAdmin.php index 674325934d86..ce8544422673 100644 --- a/AnalyticsAdmin/metadata/V1Beta/AnalyticsAdmin.php +++ b/AnalyticsAdmin/metadata/V1Beta/AnalyticsAdmin.php @@ -25,8 +25,8 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile( ' -¶š -3google/analytics/admin/v1beta/analytics_admin.protogoogle.analytics.admin.v1beta-google/analytics/admin/v1beta/resources.protogoogle/api/annotations.protogoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"ž +Ƨ +3google/analytics/admin/v1beta/analytics_admin.protogoogle.analytics.admin.v1beta-google/analytics/admin/v1beta/resources.protogoogle/api/annotations.protogoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"Ú RunAccessReportRequest entity ( B @@ -40,7 +40,9 @@ public static function initOnce() { time_zone ( ? order_bys ( 2,.google.analytics.admin.v1beta.AccessOrderBy -return_entity_quota ("» +return_entity_quota ( +include_all_users (BàA + expand_groups (BàA"» RunAccessReportResponseO dimension_headers ( 24.google.analytics.admin.v1beta.AccessDimensionHeaderI metric_headers ( 21.google.analytics.admin.v1beta.AccessMetricHeader6 @@ -191,6 +193,27 @@ public static function initOnce() { page_token ( "‚ ListConversionEventsResponseI conversion_events ( 2..google.analytics.admin.v1beta.ConversionEvent +next_page_token ( "˜ +CreateKeyEventRequest? + key_event ( 2\'.google.analytics.admin.v1beta.KeyEventBàA> +parent ( B.àAúA(&analyticsadmin.googleapis.com/KeyEvent"Ž +UpdateKeyEventRequest? + key_event ( 2\'.google.analytics.admin.v1beta.KeyEventBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"R +GetKeyEventRequest< +name ( B.àAúA( +&analyticsadmin.googleapis.com/KeyEvent"U +DeleteKeyEventRequest< +name ( B.àAúA( +&analyticsadmin.googleapis.com/KeyEvent"} +ListKeyEventsRequest> +parent ( B.àAúA(&analyticsadmin.googleapis.com/KeyEvent + page_size ( + +page_token ( "m +ListKeyEventsResponse; + +key_events ( 2\'.google.analytics.admin.v1beta.KeyEvent next_page_token ( "´ CreateCustomDimensionRequestE parent ( B5àAúA/-analyticsadmin.googleapis.com/CustomDimensionM @@ -257,7 +280,7 @@ public static function initOnce() { next_page_token ( "V GetDataStreamRequest> name ( B0àAúA* -(analyticsadmin.googleapis.com/DataStream2ÛP +(analyticsadmin.googleapis.com/DataStream2ïW AnalyticsAdminService GetAccount0.google.analytics.admin.v1beta.GetAccountRequest&.google.analytics.admin.v1beta.Account"(ÚAname‚Óä“/v1beta/{name=accounts/*}‘ @@ -285,12 +308,17 @@ public static function initOnce() { DeleteMeasurementProtocolSecretE.google.analytics.admin.v1beta.DeleteMeasurementProtocolSecretRequest.google.protobuf.Empty"UÚAname‚Óä“H*F/v1beta/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}× UpdateMeasurementProtocolSecretE.google.analytics.admin.v1beta.UpdateMeasurementProtocolSecretRequest8.google.analytics.admin.v1beta.MeasurementProtocolSecret"²ÚA\'measurement_protocol_secret,update_mask‚Óä“2b/v1beta/{measurement_protocol_secret.name=properties/*/dataStreams/*/measurementProtocolSecrets/*}:measurement_protocol_secretô AcknowledgeUserDataCollectionC.google.analytics.admin.v1beta.AcknowledgeUserDataCollectionRequestD.google.analytics.admin.v1beta.AcknowledgeUserDataCollectionResponse"H‚Óä“B"=/v1beta/{property=properties/*}:acknowledgeUserDataCollection:*á -SearchChangeHistoryEvents?.google.analytics.admin.v1beta.SearchChangeHistoryEventsRequest@.google.analytics.admin.v1beta.SearchChangeHistoryEventsResponse"A‚Óä“;"6/v1beta/{account=accounts/*}:searchChangeHistoryEvents:*è -CreateConversionEvent;.google.analytics.admin.v1beta.CreateConversionEventRequest..google.analytics.admin.v1beta.ConversionEvent"bÚAparent,conversion_event‚Óä“B"./v1beta/{parent=properties/*}/conversionEvents:conversion_eventþ -UpdateConversionEvent;.google.analytics.admin.v1beta.UpdateConversionEventRequest..google.analytics.admin.v1beta.ConversionEvent"xÚAconversion_event,update_mask‚Óä“S2?/v1beta/{conversion_event.name=properties/*/conversionEvents/*}:conversion_event½ -GetConversionEvent8.google.analytics.admin.v1beta.GetConversionEventRequest..google.analytics.admin.v1beta.ConversionEvent"=ÚAname‚Óä“0./v1beta/{name=properties/*/conversionEvents/*}« -DeleteConversionEvent;.google.analytics.admin.v1beta.DeleteConversionEventRequest.google.protobuf.Empty"=ÚAname‚Óä“0*./v1beta/{name=properties/*/conversionEvents/*}Ð -ListConversionEvents:.google.analytics.admin.v1beta.ListConversionEventsRequest;.google.analytics.admin.v1beta.ListConversionEventsResponse"?ÚAparent‚Óä“0./v1beta/{parent=properties/*}/conversionEventsè +SearchChangeHistoryEvents?.google.analytics.admin.v1beta.SearchChangeHistoryEventsRequest@.google.analytics.admin.v1beta.SearchChangeHistoryEventsResponse"A‚Óä“;"6/v1beta/{account=accounts/*}:searchChangeHistoryEvents:*ë +CreateConversionEvent;.google.analytics.admin.v1beta.CreateConversionEventRequest..google.analytics.admin.v1beta.ConversionEvent"eˆÚAparent,conversion_event‚Óä“B"./v1beta/{parent=properties/*}/conversionEvents:conversion_event +UpdateConversionEvent;.google.analytics.admin.v1beta.UpdateConversionEventRequest..google.analytics.admin.v1beta.ConversionEvent"{ˆÚAconversion_event,update_mask‚Óä“S2?/v1beta/{conversion_event.name=properties/*/conversionEvents/*}:conversion_eventÀ +GetConversionEvent8.google.analytics.admin.v1beta.GetConversionEventRequest..google.analytics.admin.v1beta.ConversionEvent"@ˆÚAname‚Óä“0./v1beta/{name=properties/*/conversionEvents/*}® +DeleteConversionEvent;.google.analytics.admin.v1beta.DeleteConversionEventRequest.google.protobuf.Empty"@ˆÚAname‚Óä“0*./v1beta/{name=properties/*/conversionEvents/*}Ó +ListConversionEvents:.google.analytics.admin.v1beta.ListConversionEventsRequest;.google.analytics.admin.v1beta.ListConversionEventsResponse"BˆÚAparent‚Óä“0./v1beta/{parent=properties/*}/conversionEvents¾ +CreateKeyEvent4.google.analytics.admin.v1beta.CreateKeyEventRequest\'.google.analytics.admin.v1beta.KeyEvent"MÚAparent,key_event‚Óä“4"\'/v1beta/{parent=properties/*}/keyEvents: key_eventÍ +UpdateKeyEvent4.google.analytics.admin.v1beta.UpdateKeyEventRequest\'.google.analytics.admin.v1beta.KeyEvent"\\ÚAkey_event,update_mask‚Óä“>21/v1beta/{key_event.name=properties/*/keyEvents/*}: key_event¡ + GetKeyEvent1.google.analytics.admin.v1beta.GetKeyEventRequest\'.google.analytics.admin.v1beta.KeyEvent"6ÚAname‚Óä“)\'/v1beta/{name=properties/*/keyEvents/*}– +DeleteKeyEvent4.google.analytics.admin.v1beta.DeleteKeyEventRequest.google.protobuf.Empty"6ÚAname‚Óä“)*\'/v1beta/{name=properties/*/keyEvents/*}´ + ListKeyEvents3.google.analytics.admin.v1beta.ListKeyEventsRequest4.google.analytics.admin.v1beta.ListKeyEventsResponse"8ÚAparent‚Óä“)\'/v1beta/{parent=properties/*}/keyEventsè CreateCustomDimension;.google.analytics.admin.v1beta.CreateCustomDimensionRequest..google.analytics.admin.v1beta.CustomDimension"bÚAparent,custom_dimension‚Óä“B"./v1beta/{parent=properties/*}/customDimensions:custom_dimensionþ UpdateCustomDimension;.google.analytics.admin.v1beta.UpdateCustomDimensionRequest..google.analytics.admin.v1beta.CustomDimension"xÚAcustom_dimension,update_mask‚Óä“S2?/v1beta/{custom_dimension.name=properties/*/customDimensions/*}:custom_dimensionÐ ListCustomDimensions:.google.analytics.admin.v1beta.ListCustomDimensionsRequest;.google.analytics.admin.v1beta.ListCustomDimensionsResponse"?ÚAparent‚Óä“0./v1beta/{parent=properties/*}/customDimensions¸ @@ -308,8 +336,8 @@ public static function initOnce() { UpdateDataStream6.google.analytics.admin.v1beta.UpdateDataStreamRequest).google.analytics.admin.v1beta.DataStream"dÚAdata_stream,update_mask‚Óä“D25/v1beta/{data_stream.name=properties/*/dataStreams/*}: data_stream¼ ListDataStreams5.google.analytics.admin.v1beta.ListDataStreamsRequest6.google.analytics.admin.v1beta.ListDataStreamsResponse":ÚAparent‚Óä“+)/v1beta/{parent=properties/*}/dataStreams© GetDataStream3.google.analytics.admin.v1beta.GetDataStreamRequest).google.analytics.admin.v1beta.DataStream"8ÚAname‚Óä“+)/v1beta/{name=properties/*/dataStreams/*}ì -RunAccessReport5.google.analytics.admin.v1beta.RunAccessReportRequest6.google.analytics.admin.v1beta.RunAccessReportResponse"j‚Óä“d"-/v1beta/{entity=properties/*}:runAccessReport:*Z0"+/v1beta/{entity=accounts/*}:runAccessReport:*„ÊAanalyticsadmin.googleapis.comÒAahttps://www.googleapis.com/auth/analytics.edit,https://www.googleapis.com/auth/analytics.readonlyB~ -!com.google.analytics.admin.v1betaBAnalyticsAdminProtoPZBgoogle.golang.org/genproto/googleapis/analytics/admin/v1beta;adminbproto3' +RunAccessReport5.google.analytics.admin.v1beta.RunAccessReportRequest6.google.analytics.admin.v1beta.RunAccessReportResponse"j‚Óä“d"-/v1beta/{entity=properties/*}:runAccessReport:*Z0"+/v1beta/{entity=accounts/*}:runAccessReport:*„ÊAanalyticsadmin.googleapis.comÒAahttps://www.googleapis.com/auth/analytics.edit,https://www.googleapis.com/auth/analytics.readonlyBy +!com.google.analytics.admin.v1betaBAnalyticsAdminProtoPZ=cloud.google.com/go/analytics/admin/apiv1beta/adminpb;adminpbbproto3' , true); static::$is_initialized = true; diff --git a/AnalyticsAdmin/metadata/V1Beta/Resources.php b/AnalyticsAdmin/metadata/V1Beta/Resources.php index 7d44f3171098bfd170b12ed784ffcee89d8015c7..fee33d6952e37d9a3fd3b8d723fd07cf7b91956b 100644 GIT binary patch delta 759 zcmaFk^)P6|c_yagK9espt!8{Oxt967sZa=)KzeRLe11`SVqRudVo7Fxo&>uBqXwsw z)dNT7UydeRM!AVa*{LO&dFcf?i6v?IMY)q1r9^rBk#ubKVaX9j*%2%)F0#WGA10~ioL`y;3NYW)l8pQmkYAXD0=Rf#CPPDFvaXnFJzNjej|ksOxpDCz z3xd3sSDKqzl$i_-OR%>grepUuSWYRLix1U7Lh@YF&i6Be zZE{Y2X^LKYetvpRsvb~AKRsVRF)uNvvLrLPSU)i(H#1K^u^_X|Fe$Yp5yCG>vIdJ6 dB)xJB!jbZ{kW-$J406f^Iu)5)J6T@U7XVpu|1AIj delta 120 zcmaDD^u}w$c_yYyE|V`Zt!C_-T+4i()ynRbqxED%cJsetCountingMethod($keyEventCountingMethod); + $request = (new CreateKeyEventRequest()) + ->setKeyEvent($keyEvent) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var KeyEvent $response */ + $response = $analyticsAdminServiceClient->createKeyEvent($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]'); + + create_key_event_sample($keyEventCountingMethod, $formattedParent); +} +// [END analyticsadmin_v1beta_generated_AnalyticsAdminService_CreateKeyEvent_sync] diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_account.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_account.php index dce70fa6a4f6..ebc711c6197f 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_account.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_account.php @@ -35,7 +35,7 @@ * * If the accounts are not restored before the expiration time, the account * and all child resources (eg: Properties, GoogleAdsLinks, Streams, - * UserLinks) will be permanently purged. + * AccessBindings) will be permanently purged. * https://support.google.com/analytics/answer/6154772 * * Returns an error if the target is not found. diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_conversion_event.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_conversion_event.php index 84d420a33c5a..bde462b5ca50 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_conversion_event.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_conversion_event.php @@ -28,6 +28,7 @@ use Google\ApiCore\ApiException; /** + * Deprecated: Use `DeleteKeyEvent` instead. * Deletes a conversion event in a property. * * @param string $formattedName The resource name of the conversion event to delete. diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_firebase_link.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_firebase_link.php index 519a3440bbee..592f6ea80703 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_firebase_link.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_firebase_link.php @@ -31,7 +31,8 @@ * Deletes a FirebaseLink on a property * * @param string $formattedName Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * + * Example: `properties/1234/firebaseLinks/5678` * Please see {@see AnalyticsAdminServiceClient::firebaseLinkName()} for help formatting this field. */ function delete_firebase_link_sample(string $formattedName): void diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_key_event.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_key_event.php new file mode 100644 index 000000000000..5a4371f71cd5 --- /dev/null +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_key_event.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $analyticsAdminServiceClient->deleteKeyEvent($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AnalyticsAdminServiceClient::keyEventName('[PROPERTY]', '[KEY_EVENT]'); + + delete_key_event_sample($formattedName); +} +// [END analyticsadmin_v1beta_generated_AnalyticsAdminService_DeleteKeyEvent_sync] diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_property.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_property.php index 349e0a3ae828..4414a4d853c7 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_property.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/delete_property.php @@ -35,7 +35,7 @@ * However, they can be restored using the Trash Can UI. * * If the properties are not restored before the expiration time, the Property - * and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) + * and all child resources (eg: GoogleAdsLinks, Streams, AccessBindings) * will be permanently purged. * https://support.google.com/analytics/answer/6154772 * diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_conversion_event.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_conversion_event.php index 308fcf966078..ba81139761fa 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_conversion_event.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_conversion_event.php @@ -29,6 +29,7 @@ use Google\ApiCore\ApiException; /** + * Deprecated: Use `GetKeyEvent` instead. * Retrieve a single conversion event. * * @param string $formattedName The resource name of the conversion event to retrieve. diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_data_sharing_settings.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_data_sharing_settings.php index 77a5644cb08f..3e24eb5a17da 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_data_sharing_settings.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_data_sharing_settings.php @@ -34,7 +34,8 @@ * * @param string $formattedName The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * + * Example: `accounts/1000/dataSharingSettings` * Please see {@see AnalyticsAdminServiceClient::dataSharingSettingsName()} for help formatting this field. */ function get_data_sharing_settings_sample(string $formattedName): void diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_key_event.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_key_event.php new file mode 100644 index 000000000000..06134c5a3efc --- /dev/null +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/get_key_event.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var KeyEvent $response */ + $response = $analyticsAdminServiceClient->getKeyEvent($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AnalyticsAdminServiceClient::keyEventName('[PROPERTY]', '[KEY_EVENT]'); + + get_key_event_sample($formattedName); +} +// [END analyticsadmin_v1beta_generated_AnalyticsAdminService_GetKeyEvent_sync] diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_conversion_events.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_conversion_events.php index 40ecb6ef519b..331ab629b5b8 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_conversion_events.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_conversion_events.php @@ -30,6 +30,7 @@ use Google\ApiCore\PagedListResponse; /** + * Deprecated: Use `ListKeyEvents` instead. * Returns a list of conversion events in the specified parent property. * * Returns an empty list if no conversion events are found. diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_firebase_links.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_firebase_links.php index 4b8f5c6f6d54..aaab7b06b76e 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_firebase_links.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_firebase_links.php @@ -34,7 +34,8 @@ * Properties can have at most one FirebaseLink. * * @param string $formattedParent Format: properties/{property_id} - * Example: properties/1234 + * + * Example: `properties/1234` * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field. */ function list_firebase_links_sample(string $formattedParent): void diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_key_events.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_key_events.php new file mode 100644 index 000000000000..d75224a6b67e --- /dev/null +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/list_key_events.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $analyticsAdminServiceClient->listKeyEvents($request); + + /** @var KeyEvent $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]'); + + list_key_events_sample($formattedParent); +} +// [END analyticsadmin_v1beta_generated_AnalyticsAdminService_ListKeyEvents_sync] diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/run_access_report.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/run_access_report.php index c51342af5d2c..d86443b5bec2 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/run_access_report.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/run_access_report.php @@ -33,8 +33,10 @@ * records of each time a user reads Google Analytics reporting data. Access * records are retained for up to 2 years. * - * Data Access Reports can be requested for a property. The property must be - * in Google Analytics 360. This method is only available to Administrators. + * Data Access Reports can be requested for a property. Reports may be + * requested for any property, but dimensions that aren't related to quota can + * only be requested on Google Analytics 360 properties. This method is only + * available to Administrators. * * These data access records include GA4 UI Reporting, GA4 UI Explorations, * GA4 Data API, and other products like Firebase & Admob that can retrieve diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/search_change_history_events.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/search_change_history_events.php index 87d557a5c6b6..cbd4c549cc8b 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/search_change_history_events.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/search_change_history_events.php @@ -34,8 +34,10 @@ * specified set of filters. * * @param string $formattedAccount The account resource for which to return change history - * resources. Please see - * {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field. + * resources. Format: accounts/{account} + * + * Example: `accounts/100` + * Please see {@see AnalyticsAdminServiceClient::accountName()} for help formatting this field. */ function search_change_history_events_sample(string $formattedAccount): void { diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_conversion_event.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_conversion_event.php index b52446f2677d..09208c6790ab 100644 --- a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_conversion_event.php +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_conversion_event.php @@ -30,6 +30,7 @@ use Google\Protobuf\FieldMask; /** + * Deprecated: Use `UpdateKeyEvent` instead. * Updates a conversion event with the specified attributes. * * This sample has been automatically generated and should be regarded as a code diff --git a/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_key_event.php b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_key_event.php new file mode 100644 index 000000000000..141965b8b344 --- /dev/null +++ b/AnalyticsAdmin/samples/V1beta/AnalyticsAdminServiceClient/update_key_event.php @@ -0,0 +1,77 @@ +setCountingMethod($keyEventCountingMethod); + $updateMask = new FieldMask(); + $request = (new UpdateKeyEventRequest()) + ->setKeyEvent($keyEvent) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var KeyEvent $response */ + $response = $analyticsAdminServiceClient->updateKeyEvent($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + + update_key_event_sample($keyEventCountingMethod); +} +// [END analyticsadmin_v1beta_generated_AnalyticsAdminService_UpdateKeyEvent_sync] diff --git a/AnalyticsAdmin/src/V1beta/Account.php b/AnalyticsAdmin/src/V1beta/Account.php index 5f9f80afa10a..cd8e20a53530 100644 --- a/AnalyticsAdmin/src/V1beta/Account.php +++ b/AnalyticsAdmin/src/V1beta/Account.php @@ -54,6 +54,14 @@ class Account extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool deleted = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $deleted = false; + /** + * Output only. The URI for a Google Marketing Platform organization resource. + * Only set when this account is connected to a GMP organization. + * Format: marketingplatformadmin.googleapis.com/organizations/{org_id} + * + * Generated from protobuf field string gmp_organization = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $gmp_organization = ''; /** * Constructor. @@ -76,6 +84,10 @@ class Account extends \Google\Protobuf\Internal\Message * @type bool $deleted * Output only. Indicates whether this Account is soft-deleted or not. Deleted * accounts are excluded from List results unless specifically requested. + * @type string $gmp_organization + * Output only. The URI for a Google Marketing Platform organization resource. + * Only set when this account is connected to a GMP organization. + * Format: marketingplatformadmin.googleapis.com/organizations/{org_id} * } */ public function __construct($data = NULL) { @@ -265,5 +277,35 @@ public function setDeleted($var) return $this; } + /** + * Output only. The URI for a Google Marketing Platform organization resource. + * Only set when this account is connected to a GMP organization. + * Format: marketingplatformadmin.googleapis.com/organizations/{org_id} + * + * Generated from protobuf field string gmp_organization = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getGmpOrganization() + { + return $this->gmp_organization; + } + + /** + * Output only. The URI for a Google Marketing Platform organization resource. + * Only set when this account is connected to a GMP organization. + * Format: marketingplatformadmin.googleapis.com/organizations/{org_id} + * + * Generated from protobuf field string gmp_organization = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGmpOrganization($var) + { + GPBUtil::checkString($var, True); + $this->gmp_organization = $var; + + return $this; + } + } diff --git a/AnalyticsAdmin/src/V1beta/Client/AnalyticsAdminServiceClient.php b/AnalyticsAdmin/src/V1beta/Client/AnalyticsAdminServiceClient.php index 66dab8a609d9..73d2403cd831 100644 --- a/AnalyticsAdmin/src/V1beta/Client/AnalyticsAdminServiceClient.php +++ b/AnalyticsAdmin/src/V1beta/Client/AnalyticsAdminServiceClient.php @@ -38,6 +38,7 @@ use Google\Analytics\Admin\V1beta\CreateDataStreamRequest; use Google\Analytics\Admin\V1beta\CreateFirebaseLinkRequest; use Google\Analytics\Admin\V1beta\CreateGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\CreateKeyEventRequest; use Google\Analytics\Admin\V1beta\CreateMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\CreatePropertyRequest; use Google\Analytics\Admin\V1beta\CustomDimension; @@ -50,6 +51,7 @@ use Google\Analytics\Admin\V1beta\DeleteDataStreamRequest; use Google\Analytics\Admin\V1beta\DeleteFirebaseLinkRequest; use Google\Analytics\Admin\V1beta\DeleteGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\DeleteKeyEventRequest; use Google\Analytics\Admin\V1beta\DeleteMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\DeletePropertyRequest; use Google\Analytics\Admin\V1beta\FirebaseLink; @@ -60,9 +62,11 @@ use Google\Analytics\Admin\V1beta\GetDataRetentionSettingsRequest; use Google\Analytics\Admin\V1beta\GetDataSharingSettingsRequest; use Google\Analytics\Admin\V1beta\GetDataStreamRequest; +use Google\Analytics\Admin\V1beta\GetKeyEventRequest; use Google\Analytics\Admin\V1beta\GetMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\GetPropertyRequest; use Google\Analytics\Admin\V1beta\GoogleAdsLink; +use Google\Analytics\Admin\V1beta\KeyEvent; use Google\Analytics\Admin\V1beta\ListAccountSummariesRequest; use Google\Analytics\Admin\V1beta\ListAccountsRequest; use Google\Analytics\Admin\V1beta\ListConversionEventsRequest; @@ -71,6 +75,7 @@ use Google\Analytics\Admin\V1beta\ListDataStreamsRequest; use Google\Analytics\Admin\V1beta\ListFirebaseLinksRequest; use Google\Analytics\Admin\V1beta\ListGoogleAdsLinksRequest; +use Google\Analytics\Admin\V1beta\ListKeyEventsRequest; use Google\Analytics\Admin\V1beta\ListMeasurementProtocolSecretsRequest; use Google\Analytics\Admin\V1beta\ListPropertiesRequest; use Google\Analytics\Admin\V1beta\MeasurementProtocolSecret; @@ -87,6 +92,7 @@ use Google\Analytics\Admin\V1beta\UpdateDataRetentionSettingsRequest; use Google\Analytics\Admin\V1beta\UpdateDataStreamRequest; use Google\Analytics\Admin\V1beta\UpdateGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\UpdateKeyEventRequest; use Google\Analytics\Admin\V1beta\UpdateMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\UpdatePropertyRequest; use Google\ApiCore\ApiException; @@ -122,6 +128,7 @@ * @method PromiseInterface createDataStreamAsync(CreateDataStreamRequest $request, array $optionalArgs = []) * @method PromiseInterface createFirebaseLinkAsync(CreateFirebaseLinkRequest $request, array $optionalArgs = []) * @method PromiseInterface createGoogleAdsLinkAsync(CreateGoogleAdsLinkRequest $request, array $optionalArgs = []) + * @method PromiseInterface createKeyEventAsync(CreateKeyEventRequest $request, array $optionalArgs = []) * @method PromiseInterface createMeasurementProtocolSecretAsync(CreateMeasurementProtocolSecretRequest $request, array $optionalArgs = []) * @method PromiseInterface createPropertyAsync(CreatePropertyRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteAccountAsync(DeleteAccountRequest $request, array $optionalArgs = []) @@ -129,6 +136,7 @@ * @method PromiseInterface deleteDataStreamAsync(DeleteDataStreamRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteFirebaseLinkAsync(DeleteFirebaseLinkRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteGoogleAdsLinkAsync(DeleteGoogleAdsLinkRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteKeyEventAsync(DeleteKeyEventRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteMeasurementProtocolSecretAsync(DeleteMeasurementProtocolSecretRequest $request, array $optionalArgs = []) * @method PromiseInterface deletePropertyAsync(DeletePropertyRequest $request, array $optionalArgs = []) * @method PromiseInterface getAccountAsync(GetAccountRequest $request, array $optionalArgs = []) @@ -138,6 +146,7 @@ * @method PromiseInterface getDataRetentionSettingsAsync(GetDataRetentionSettingsRequest $request, array $optionalArgs = []) * @method PromiseInterface getDataSharingSettingsAsync(GetDataSharingSettingsRequest $request, array $optionalArgs = []) * @method PromiseInterface getDataStreamAsync(GetDataStreamRequest $request, array $optionalArgs = []) + * @method PromiseInterface getKeyEventAsync(GetKeyEventRequest $request, array $optionalArgs = []) * @method PromiseInterface getMeasurementProtocolSecretAsync(GetMeasurementProtocolSecretRequest $request, array $optionalArgs = []) * @method PromiseInterface getPropertyAsync(GetPropertyRequest $request, array $optionalArgs = []) * @method PromiseInterface listAccountSummariesAsync(ListAccountSummariesRequest $request, array $optionalArgs = []) @@ -148,6 +157,7 @@ * @method PromiseInterface listDataStreamsAsync(ListDataStreamsRequest $request, array $optionalArgs = []) * @method PromiseInterface listFirebaseLinksAsync(ListFirebaseLinksRequest $request, array $optionalArgs = []) * @method PromiseInterface listGoogleAdsLinksAsync(ListGoogleAdsLinksRequest $request, array $optionalArgs = []) + * @method PromiseInterface listKeyEventsAsync(ListKeyEventsRequest $request, array $optionalArgs = []) * @method PromiseInterface listMeasurementProtocolSecretsAsync(ListMeasurementProtocolSecretsRequest $request, array $optionalArgs = []) * @method PromiseInterface listPropertiesAsync(ListPropertiesRequest $request, array $optionalArgs = []) * @method PromiseInterface provisionAccountTicketAsync(ProvisionAccountTicketRequest $request, array $optionalArgs = []) @@ -160,6 +170,7 @@ * @method PromiseInterface updateDataRetentionSettingsAsync(UpdateDataRetentionSettingsRequest $request, array $optionalArgs = []) * @method PromiseInterface updateDataStreamAsync(UpdateDataStreamRequest $request, array $optionalArgs = []) * @method PromiseInterface updateGoogleAdsLinkAsync(UpdateGoogleAdsLinkRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateKeyEventAsync(UpdateKeyEventRequest $request, array $optionalArgs = []) * @method PromiseInterface updateMeasurementProtocolSecretAsync(UpdateMeasurementProtocolSecretRequest $request, array $optionalArgs = []) * @method PromiseInterface updatePropertyAsync(UpdatePropertyRequest $request, array $optionalArgs = []) */ @@ -377,6 +388,25 @@ public static function googleAdsLinkName(string $property, string $googleAdsLink ]); } + /** + * Formats a string containing the fully-qualified path to represent a key_event + * resource. + * + * @param string $property + * @param string $keyEvent + * + * @return string The formatted key_event resource. + * + * @experimental + */ + public static function keyEventName(string $property, string $keyEvent): string + { + return self::getPathTemplate('keyEvent')->render([ + 'property' => $property, + 'key_event' => $keyEvent, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * measurement_protocol_secret resource. @@ -398,6 +428,23 @@ public static function measurementProtocolSecretName(string $property, string $d ]); } + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + * + * @experimental + */ + public static function organizationName(string $organization): string + { + return self::getPathTemplate('organization')->render([ + 'organization' => $organization, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a property * resource. @@ -428,7 +475,9 @@ public static function propertyName(string $property): string * - dataStream: properties/{property}/dataStreams/{data_stream} * - firebaseLink: properties/{property}/firebaseLinks/{firebase_link} * - googleAdsLink: properties/{property}/googleAdsLinks/{google_ads_link} + * - keyEvent: properties/{property}/keyEvents/{key_event} * - measurementProtocolSecret: properties/{property}/dataStreams/{data_stream}/measurementProtocolSecrets/{measurement_protocol_secret} + * - organization: organizations/{organization} * - property: properties/{property} * * The optional $template argument can be supplied to specify a particular pattern, @@ -612,6 +661,7 @@ public function archiveCustomMetric(ArchiveCustomMetricRequest $request, array $ } /** + * Deprecated: Use `CreateKeyEvent` instead. * Creates a conversion event with the specified attributes. * * The async variant is @@ -634,6 +684,8 @@ public function archiveCustomMetric(ArchiveCustomMetricRequest $request, array $ * @throws ApiException Thrown if the API call fails. * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function createConversionEvent(CreateConversionEventRequest $request, array $callOptions = []): ConversionEvent { @@ -787,6 +839,34 @@ public function createGoogleAdsLink(CreateGoogleAdsLinkRequest $request, array $ return $this->startApiCall('CreateGoogleAdsLink', $request, $callOptions)->wait(); } + /** + * Creates a Key Event. + * + * The async variant is {@see AnalyticsAdminServiceClient::createKeyEventAsync()} . + * + * @example samples/V1beta/AnalyticsAdminServiceClient/create_key_event.php + * + * @param CreateKeyEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return KeyEvent + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createKeyEvent(CreateKeyEventRequest $request, array $callOptions = []): KeyEvent + { + return $this->startApiCall('CreateKeyEvent', $request, $callOptions)->wait(); + } + /** * Creates a measurement protocol secret. * @@ -852,7 +932,7 @@ public function createProperty(CreatePropertyRequest $request, array $callOption * * If the accounts are not restored before the expiration time, the account * and all child resources (eg: Properties, GoogleAdsLinks, Streams, - * UserLinks) will be permanently purged. + * AccessBindings) will be permanently purged. * https://support.google.com/analytics/answer/6154772 * * Returns an error if the target is not found. @@ -881,6 +961,7 @@ public function deleteAccount(DeleteAccountRequest $request, array $callOptions } /** + * Deprecated: Use `DeleteKeyEvent` instead. * Deletes a conversion event in a property. * * The async variant is @@ -901,6 +982,8 @@ public function deleteAccount(DeleteAccountRequest $request, array $callOptions * @throws ApiException Thrown if the API call fails. * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function deleteConversionEvent(DeleteConversionEventRequest $request, array $callOptions = []): void { @@ -988,6 +1071,32 @@ public function deleteGoogleAdsLink(DeleteGoogleAdsLinkRequest $request, array $ $this->startApiCall('DeleteGoogleAdsLink', $request, $callOptions)->wait(); } + /** + * Deletes a Key Event. + * + * The async variant is {@see AnalyticsAdminServiceClient::deleteKeyEventAsync()} . + * + * @example samples/V1beta/AnalyticsAdminServiceClient/delete_key_event.php + * + * @param DeleteKeyEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function deleteKeyEvent(DeleteKeyEventRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteKeyEvent', $request, $callOptions)->wait(); + } + /** * Deletes target MeasurementProtocolSecret. * @@ -1022,7 +1131,7 @@ public function deleteMeasurementProtocolSecret(DeleteMeasurementProtocolSecretR * However, they can be restored using the Trash Can UI. * * If the properties are not restored before the expiration time, the Property - * and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) + * and all child resources (eg: GoogleAdsLinks, Streams, AccessBindings) * will be permanently purged. * https://support.google.com/analytics/answer/6154772 * @@ -1082,6 +1191,7 @@ public function getAccount(GetAccountRequest $request, array $callOptions = []): } /** + * Deprecated: Use `GetKeyEvent` instead. * Retrieve a single conversion event. * * The async variant is @@ -1104,6 +1214,8 @@ public function getAccount(GetAccountRequest $request, array $callOptions = []): * @throws ApiException Thrown if the API call fails. * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function getConversionEvent(GetConversionEventRequest $request, array $callOptions = []): ConversionEvent { @@ -1255,6 +1367,34 @@ public function getDataStream(GetDataStreamRequest $request, array $callOptions return $this->startApiCall('GetDataStream', $request, $callOptions)->wait(); } + /** + * Retrieve a single Key Event. + * + * The async variant is {@see AnalyticsAdminServiceClient::getKeyEventAsync()} . + * + * @example samples/V1beta/AnalyticsAdminServiceClient/get_key_event.php + * + * @param GetKeyEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return KeyEvent + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getKeyEvent(GetKeyEventRequest $request, array $callOptions = []): KeyEvent + { + return $this->startApiCall('GetKeyEvent', $request, $callOptions)->wait(); + } + /** * Lookup for a single "GA4" MeasurementProtocolSecret. * @@ -1374,6 +1514,7 @@ public function listAccounts(ListAccountsRequest $request, array $callOptions = } /** + * Deprecated: Use `ListKeyEvents` instead. * Returns a list of conversion events in the specified parent property. * * Returns an empty list if no conversion events are found. @@ -1398,6 +1539,8 @@ public function listAccounts(ListAccountsRequest $request, array $callOptions = * @throws ApiException Thrown if the API call fails. * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function listConversionEvents(ListConversionEventsRequest $request, array $callOptions = []): PagedListResponse { @@ -1550,6 +1693,35 @@ public function listGoogleAdsLinks(ListGoogleAdsLinksRequest $request, array $ca return $this->startApiCall('ListGoogleAdsLinks', $request, $callOptions); } + /** + * Returns a list of Key Events in the specified parent property. + * Returns an empty list if no Key Events are found. + * + * The async variant is {@see AnalyticsAdminServiceClient::listKeyEventsAsync()} . + * + * @example samples/V1beta/AnalyticsAdminServiceClient/list_key_events.php + * + * @param ListKeyEventsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function listKeyEvents(ListKeyEventsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListKeyEvents', $request, $callOptions); + } + /** * Returns child MeasurementProtocolSecrets under the specified parent * Property. @@ -1647,8 +1819,10 @@ public function provisionAccountTicket(ProvisionAccountTicketRequest $request, a * records of each time a user reads Google Analytics reporting data. Access * records are retained for up to 2 years. * - * Data Access Reports can be requested for a property. The property must be - * in Google Analytics 360. This method is only available to Administrators. + * Data Access Reports can be requested for a property. Reports may be + * requested for any property, but dimensions that aren't related to quota can + * only be requested on Google Analytics 360 properties. This method is only + * available to Administrators. * * These data access records include GA4 UI Reporting, GA4 UI Explorations, * GA4 Data API, and other products like Firebase & Admob that can retrieve @@ -1742,6 +1916,7 @@ public function updateAccount(UpdateAccountRequest $request, array $callOptions } /** + * Deprecated: Use `UpdateKeyEvent` instead. * Updates a conversion event with the specified attributes. * * The async variant is @@ -1764,6 +1939,8 @@ public function updateAccount(UpdateAccountRequest $request, array $callOptions * @throws ApiException Thrown if the API call fails. * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function updateConversionEvent(UpdateConversionEventRequest $request, array $callOptions = []): ConversionEvent { @@ -1915,6 +2092,34 @@ public function updateGoogleAdsLink(UpdateGoogleAdsLinkRequest $request, array $ return $this->startApiCall('UpdateGoogleAdsLink', $request, $callOptions)->wait(); } + /** + * Updates a Key Event. + * + * The async variant is {@see AnalyticsAdminServiceClient::updateKeyEventAsync()} . + * + * @example samples/V1beta/AnalyticsAdminServiceClient/update_key_event.php + * + * @param UpdateKeyEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return KeyEvent + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function updateKeyEvent(UpdateKeyEventRequest $request, array $callOptions = []): KeyEvent + { + return $this->startApiCall('UpdateKeyEvent', $request, $callOptions)->wait(); + } + /** * Updates a measurement protocol secret. * diff --git a/AnalyticsAdmin/src/V1beta/ConversionEvent.php b/AnalyticsAdmin/src/V1beta/ConversionEvent.php index 4835d5c284d9..a233a794cedf 100644 --- a/AnalyticsAdmin/src/V1beta/ConversionEvent.php +++ b/AnalyticsAdmin/src/V1beta/ConversionEvent.php @@ -61,6 +61,12 @@ class ConversionEvent extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.analytics.admin.v1beta.ConversionEvent.ConversionCountingMethod counting_method = 6 [(.google.api.field_behavior) = OPTIONAL]; */ private $counting_method = 0; + /** + * Optional. Defines a default value/currency for a conversion event. + * + * Generated from protobuf field optional .google.analytics.admin.v1beta.ConversionEvent.DefaultConversionValue default_conversion_value = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $default_conversion_value = null; /** * Constructor. @@ -90,6 +96,8 @@ class ConversionEvent extends \Google\Protobuf\Internal\Message * Optional. The method by which conversions will be counted across multiple * events within a session. If this value is not provided, it will be set to * `ONCE_PER_EVENT`. + * @type \Google\Analytics\Admin\V1beta\ConversionEvent\DefaultConversionValue $default_conversion_value + * Optional. Defines a default value/currency for a conversion event. * } */ public function __construct($data = NULL) { @@ -283,5 +291,41 @@ public function setCountingMethod($var) return $this; } + /** + * Optional. Defines a default value/currency for a conversion event. + * + * Generated from protobuf field optional .google.analytics.admin.v1beta.ConversionEvent.DefaultConversionValue default_conversion_value = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Analytics\Admin\V1beta\ConversionEvent\DefaultConversionValue|null + */ + public function getDefaultConversionValue() + { + return $this->default_conversion_value; + } + + public function hasDefaultConversionValue() + { + return isset($this->default_conversion_value); + } + + public function clearDefaultConversionValue() + { + unset($this->default_conversion_value); + } + + /** + * Optional. Defines a default value/currency for a conversion event. + * + * Generated from protobuf field optional .google.analytics.admin.v1beta.ConversionEvent.DefaultConversionValue default_conversion_value = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Analytics\Admin\V1beta\ConversionEvent\DefaultConversionValue $var + * @return $this + */ + public function setDefaultConversionValue($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1beta\ConversionEvent\DefaultConversionValue::class); + $this->default_conversion_value = $var; + + return $this; + } + } diff --git a/AnalyticsAdmin/src/V1beta/ConversionEvent/DefaultConversionValue.php b/AnalyticsAdmin/src/V1beta/ConversionEvent/DefaultConversionValue.php new file mode 100644 index 000000000000..687b9c24f257 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/ConversionEvent/DefaultConversionValue.php @@ -0,0 +1,141 @@ +google.analytics.admin.v1beta.ConversionEvent.DefaultConversionValue + */ +class DefaultConversionValue extends \Google\Protobuf\Internal\Message +{ + /** + * This value will be used to populate the value for all conversions + * of the specified event_name where the event "value" parameter is unset. + * + * Generated from protobuf field optional double value = 1; + */ + private $value = null; + /** + * When a conversion event for this event_name has no set currency, + * this currency will be applied as the default. Must be in ISO 4217 + * currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for + * more information. + * + * Generated from protobuf field optional string currency_code = 2; + */ + private $currency_code = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $value + * This value will be used to populate the value for all conversions + * of the specified event_name where the event "value" parameter is unset. + * @type string $currency_code + * When a conversion event for this event_name has no set currency, + * this currency will be applied as the default. Must be in ISO 4217 + * currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for + * more information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * This value will be used to populate the value for all conversions + * of the specified event_name where the event "value" parameter is unset. + * + * Generated from protobuf field optional double value = 1; + * @return float + */ + public function getValue() + { + return isset($this->value) ? $this->value : 0.0; + } + + public function hasValue() + { + return isset($this->value); + } + + public function clearValue() + { + unset($this->value); + } + + /** + * This value will be used to populate the value for all conversions + * of the specified event_name where the event "value" parameter is unset. + * + * Generated from protobuf field optional double value = 1; + * @param float $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkDouble($var); + $this->value = $var; + + return $this; + } + + /** + * When a conversion event for this event_name has no set currency, + * this currency will be applied as the default. Must be in ISO 4217 + * currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for + * more information. + * + * Generated from protobuf field optional string currency_code = 2; + * @return string + */ + public function getCurrencyCode() + { + return isset($this->currency_code) ? $this->currency_code : ''; + } + + public function hasCurrencyCode() + { + return isset($this->currency_code); + } + + public function clearCurrencyCode() + { + unset($this->currency_code); + } + + /** + * When a conversion event for this event_name has no set currency, + * this currency will be applied as the default. Must be in ISO 4217 + * currency code format. See https://en.wikipedia.org/wiki/ISO_4217 for + * more information. + * + * Generated from protobuf field optional string currency_code = 2; + * @param string $var + * @return $this + */ + public function setCurrencyCode($var) + { + GPBUtil::checkString($var, True); + $this->currency_code = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DefaultConversionValue::class, \Google\Analytics\Admin\V1beta\ConversionEvent_DefaultConversionValue::class); + diff --git a/AnalyticsAdmin/src/V1beta/CreateFirebaseLinkRequest.php b/AnalyticsAdmin/src/V1beta/CreateFirebaseLinkRequest.php index 3fa9d185a735..d7850b9b9fa4 100644 --- a/AnalyticsAdmin/src/V1beta/CreateFirebaseLinkRequest.php +++ b/AnalyticsAdmin/src/V1beta/CreateFirebaseLinkRequest.php @@ -17,7 +17,7 @@ class CreateFirebaseLinkRequest extends \Google\Protobuf\Internal\Message { /** * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -31,7 +31,8 @@ class CreateFirebaseLinkRequest extends \Google\Protobuf\Internal\Message /** * @param string $parent Required. Format: properties/{property_id} - * Example: properties/1234 + * + * Example: `properties/1234` * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field. * @param \Google\Analytics\Admin\V1beta\FirebaseLink $firebaseLink Required. The Firebase link to create. * @@ -54,7 +55,7 @@ public static function build(string $parent, \Google\Analytics\Admin\V1beta\Fire * * @type string $parent * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * @type \Google\Analytics\Admin\V1beta\FirebaseLink $firebase_link * Required. The Firebase link to create. * } @@ -66,7 +67,7 @@ public function __construct($data = NULL) { /** * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -78,7 +79,7 @@ public function getParent() /** * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/AnalyticsAdmin/src/V1beta/CreateKeyEventRequest.php b/AnalyticsAdmin/src/V1beta/CreateKeyEventRequest.php new file mode 100644 index 000000000000..79440f311443 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/CreateKeyEventRequest.php @@ -0,0 +1,132 @@ +google.analytics.admin.v1beta.CreateKeyEventRequest + */ +class CreateKeyEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Key Event to create. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent key_event = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $key_event = null; + /** + * Required. The resource name of the parent property where this Key Event + * will be created. Format: properties/123 + * + * Generated from protobuf field string parent = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + + /** + * @param string $parent Required. The resource name of the parent property where this Key Event + * will be created. Format: properties/123 + * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field. + * @param \Google\Analytics\Admin\V1beta\KeyEvent $keyEvent Required. The Key Event to create. + * + * @return \Google\Analytics\Admin\V1beta\CreateKeyEventRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Analytics\Admin\V1beta\KeyEvent $keyEvent): self + { + return (new self()) + ->setParent($parent) + ->setKeyEvent($keyEvent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Analytics\Admin\V1beta\KeyEvent $key_event + * Required. The Key Event to create. + * @type string $parent + * Required. The resource name of the parent property where this Key Event + * will be created. Format: properties/123 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\AnalyticsAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Key Event to create. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent key_event = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Analytics\Admin\V1beta\KeyEvent|null + */ + public function getKeyEvent() + { + return $this->key_event; + } + + public function hasKeyEvent() + { + return isset($this->key_event); + } + + public function clearKeyEvent() + { + unset($this->key_event); + } + + /** + * Required. The Key Event to create. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent key_event = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Analytics\Admin\V1beta\KeyEvent $var + * @return $this + */ + public function setKeyEvent($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1beta\KeyEvent::class); + $this->key_event = $var; + + return $this; + } + + /** + * Required. The resource name of the parent property where this Key Event + * will be created. Format: properties/123 + * + * Generated from protobuf field string parent = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the parent property where this Key Event + * will be created. Format: properties/123 + * + * Generated from protobuf field string parent = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/DeleteFirebaseLinkRequest.php b/AnalyticsAdmin/src/V1beta/DeleteFirebaseLinkRequest.php index a0f882ebcf0a..0ccfcdc7164d 100644 --- a/AnalyticsAdmin/src/V1beta/DeleteFirebaseLinkRequest.php +++ b/AnalyticsAdmin/src/V1beta/DeleteFirebaseLinkRequest.php @@ -17,7 +17,7 @@ class DeleteFirebaseLinkRequest extends \Google\Protobuf\Internal\Message { /** * Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * Example: `properties/1234/firebaseLinks/5678` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -25,7 +25,8 @@ class DeleteFirebaseLinkRequest extends \Google\Protobuf\Internal\Message /** * @param string $name Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * + * Example: `properties/1234/firebaseLinks/5678` * Please see {@see AnalyticsAdminServiceClient::firebaseLinkName()} for help formatting this field. * * @return \Google\Analytics\Admin\V1beta\DeleteFirebaseLinkRequest @@ -46,7 +47,7 @@ public static function build(string $name): self * * @type string $name * Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * Example: `properties/1234/firebaseLinks/5678` * } */ public function __construct($data = NULL) { @@ -56,7 +57,7 @@ public function __construct($data = NULL) { /** * Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * Example: `properties/1234/firebaseLinks/5678` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -68,7 +69,7 @@ public function getName() /** * Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * Example: `properties/1234/firebaseLinks/5678` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/AnalyticsAdmin/src/V1beta/DeleteKeyEventRequest.php b/AnalyticsAdmin/src/V1beta/DeleteKeyEventRequest.php new file mode 100644 index 000000000000..c2572a90ba5f --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/DeleteKeyEventRequest.php @@ -0,0 +1,91 @@ +google.analytics.admin.v1beta.DeleteKeyEventRequest + */ +class DeleteKeyEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Key Event to delete. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * @param string $name Required. The resource name of the Key Event to delete. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * Please see {@see AnalyticsAdminServiceClient::keyEventName()} for help formatting this field. + * + * @return \Google\Analytics\Admin\V1beta\DeleteKeyEventRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Key Event to delete. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\AnalyticsAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Key Event to delete. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Key Event to delete. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/Gapic/AnalyticsAdminServiceGapicClient.php b/AnalyticsAdmin/src/V1beta/Gapic/AnalyticsAdminServiceGapicClient.php index bbe3eddf17f3..1a5c8fb592db 100644 --- a/AnalyticsAdmin/src/V1beta/Gapic/AnalyticsAdminServiceGapicClient.php +++ b/AnalyticsAdmin/src/V1beta/Gapic/AnalyticsAdminServiceGapicClient.php @@ -43,6 +43,7 @@ use Google\Analytics\Admin\V1beta\CreateDataStreamRequest; use Google\Analytics\Admin\V1beta\CreateFirebaseLinkRequest; use Google\Analytics\Admin\V1beta\CreateGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\CreateKeyEventRequest; use Google\Analytics\Admin\V1beta\CreateMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\CreatePropertyRequest; use Google\Analytics\Admin\V1beta\CustomDimension; @@ -55,6 +56,7 @@ use Google\Analytics\Admin\V1beta\DeleteDataStreamRequest; use Google\Analytics\Admin\V1beta\DeleteFirebaseLinkRequest; use Google\Analytics\Admin\V1beta\DeleteGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\DeleteKeyEventRequest; use Google\Analytics\Admin\V1beta\DeleteMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\DeletePropertyRequest; use Google\Analytics\Admin\V1beta\FirebaseLink; @@ -65,9 +67,11 @@ use Google\Analytics\Admin\V1beta\GetDataRetentionSettingsRequest; use Google\Analytics\Admin\V1beta\GetDataSharingSettingsRequest; use Google\Analytics\Admin\V1beta\GetDataStreamRequest; +use Google\Analytics\Admin\V1beta\GetKeyEventRequest; use Google\Analytics\Admin\V1beta\GetMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\GetPropertyRequest; use Google\Analytics\Admin\V1beta\GoogleAdsLink; +use Google\Analytics\Admin\V1beta\KeyEvent; use Google\Analytics\Admin\V1beta\ListAccountSummariesRequest; use Google\Analytics\Admin\V1beta\ListAccountSummariesResponse; use Google\Analytics\Admin\V1beta\ListAccountsRequest; @@ -84,6 +88,8 @@ use Google\Analytics\Admin\V1beta\ListFirebaseLinksResponse; use Google\Analytics\Admin\V1beta\ListGoogleAdsLinksRequest; use Google\Analytics\Admin\V1beta\ListGoogleAdsLinksResponse; +use Google\Analytics\Admin\V1beta\ListKeyEventsRequest; +use Google\Analytics\Admin\V1beta\ListKeyEventsResponse; use Google\Analytics\Admin\V1beta\ListMeasurementProtocolSecretsRequest; use Google\Analytics\Admin\V1beta\ListMeasurementProtocolSecretsResponse; use Google\Analytics\Admin\V1beta\ListPropertiesRequest; @@ -103,6 +109,7 @@ use Google\Analytics\Admin\V1beta\UpdateDataRetentionSettingsRequest; use Google\Analytics\Admin\V1beta\UpdateDataStreamRequest; use Google\Analytics\Admin\V1beta\UpdateGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\UpdateKeyEventRequest; use Google\Analytics\Admin\V1beta\UpdateMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\UpdatePropertyRequest; use Google\ApiCore\ApiException; @@ -191,8 +198,12 @@ class AnalyticsAdminServiceGapicClient private static $googleAdsLinkNameTemplate; + private static $keyEventNameTemplate; + private static $measurementProtocolSecretNameTemplate; + private static $organizationNameTemplate; + private static $propertyNameTemplate; private static $pathTemplateMap; @@ -297,6 +308,15 @@ private static function getGoogleAdsLinkNameTemplate() return self::$googleAdsLinkNameTemplate; } + private static function getKeyEventNameTemplate() + { + if (self::$keyEventNameTemplate == null) { + self::$keyEventNameTemplate = new PathTemplate('properties/{property}/keyEvents/{key_event}'); + } + + return self::$keyEventNameTemplate; + } + private static function getMeasurementProtocolSecretNameTemplate() { if (self::$measurementProtocolSecretNameTemplate == null) { @@ -306,6 +326,15 @@ private static function getMeasurementProtocolSecretNameTemplate() return self::$measurementProtocolSecretNameTemplate; } + private static function getOrganizationNameTemplate() + { + if (self::$organizationNameTemplate == null) { + self::$organizationNameTemplate = new PathTemplate('organizations/{organization}'); + } + + return self::$organizationNameTemplate; + } + private static function getPropertyNameTemplate() { if (self::$propertyNameTemplate == null) { @@ -328,7 +357,9 @@ private static function getPathTemplateMap() 'dataStream' => self::getDataStreamNameTemplate(), 'firebaseLink' => self::getFirebaseLinkNameTemplate(), 'googleAdsLink' => self::getGoogleAdsLinkNameTemplate(), + 'keyEvent' => self::getKeyEventNameTemplate(), 'measurementProtocolSecret' => self::getMeasurementProtocolSecretNameTemplate(), + 'organization' => self::getOrganizationNameTemplate(), 'property' => self::getPropertyNameTemplate(), ]; } @@ -501,6 +532,25 @@ public static function googleAdsLinkName($property, $googleAdsLink) ]); } + /** + * Formats a string containing the fully-qualified path to represent a key_event + * resource. + * + * @param string $property + * @param string $keyEvent + * + * @return string The formatted key_event resource. + * + * @experimental + */ + public static function keyEventName($property, $keyEvent) + { + return self::getKeyEventNameTemplate()->render([ + 'property' => $property, + 'key_event' => $keyEvent, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * measurement_protocol_secret resource. @@ -522,6 +572,23 @@ public static function measurementProtocolSecretName($property, $dataStream, $me ]); } + /** + * Formats a string containing the fully-qualified path to represent a organization + * resource. + * + * @param string $organization + * + * @return string The formatted organization resource. + * + * @experimental + */ + public static function organizationName($organization) + { + return self::getOrganizationNameTemplate()->render([ + 'organization' => $organization, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a property * resource. @@ -552,7 +619,9 @@ public static function propertyName($property) * - dataStream: properties/{property}/dataStreams/{data_stream} * - firebaseLink: properties/{property}/firebaseLinks/{firebase_link} * - googleAdsLink: properties/{property}/googleAdsLinks/{google_ads_link} + * - keyEvent: properties/{property}/keyEvents/{key_event} * - measurementProtocolSecret: properties/{property}/dataStreams/{data_stream}/measurementProtocolSecrets/{measurement_protocol_secret} + * - organization: organizations/{organization} * - property: properties/{property} * * The optional $template argument can be supplied to specify a particular pattern, @@ -790,6 +859,7 @@ public function archiveCustomMetric($name, array $optionalArgs = []) } /** + * Deprecated: Use `CreateKeyEvent` instead. * Creates a conversion event with the specified attributes. * * Sample code: @@ -821,6 +891,8 @@ public function archiveCustomMetric($name, array $optionalArgs = []) * @throws ApiException if the remote call fails * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function createConversionEvent($conversionEvent, $parent, array $optionalArgs = []) { @@ -984,7 +1056,8 @@ public function createDataStream($parent, $dataStream, array $optionalArgs = []) * ``` * * @param string $parent Required. Format: properties/{property_id} - * Example: properties/1234 + * + * Example: `properties/1234` * @param FirebaseLink $firebaseLink Required. The Firebase link to create. * @param array $optionalArgs { * Optional. @@ -1057,6 +1130,51 @@ public function createGoogleAdsLink($parent, $googleAdsLink, array $optionalArgs return $this->startCall('CreateGoogleAdsLink', GoogleAdsLink::class, $optionalArgs, $request)->wait(); } + /** + * Creates a Key Event. + * + * Sample code: + * ``` + * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient(); + * try { + * $keyEvent = new KeyEvent(); + * $formattedParent = $analyticsAdminServiceClient->propertyName('[PROPERTY]'); + * $response = $analyticsAdminServiceClient->createKeyEvent($keyEvent, $formattedParent); + * } finally { + * $analyticsAdminServiceClient->close(); + * } + * ``` + * + * @param KeyEvent $keyEvent Required. The Key Event to create. + * @param string $parent Required. The resource name of the parent property where this Key Event + * will be created. Format: properties/123 + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Analytics\Admin\V1beta\KeyEvent + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createKeyEvent($keyEvent, $parent, array $optionalArgs = []) + { + $request = new CreateKeyEventRequest(); + $requestParamHeaders = []; + $request->setKeyEvent($keyEvent); + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateKeyEvent', KeyEvent::class, $optionalArgs, $request)->wait(); + } + /** * Creates a measurement protocol secret. * @@ -1148,7 +1266,7 @@ public function createProperty($property, array $optionalArgs = []) * * If the accounts are not restored before the expiration time, the account * and all child resources (eg: Properties, GoogleAdsLinks, Streams, - * UserLinks) will be permanently purged. + * AccessBindings) will be permanently purged. * https://support.google.com/analytics/answer/6154772 * * Returns an error if the target is not found. @@ -1192,6 +1310,7 @@ public function deleteAccount($name, array $optionalArgs = []) } /** + * Deprecated: Use `DeleteKeyEvent` instead. * Deletes a conversion event in a property. * * Sample code: @@ -1220,6 +1339,8 @@ public function deleteAccount($name, array $optionalArgs = []) * @throws ApiException if the remote call fails * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function deleteConversionEvent($name, array $optionalArgs = []) { @@ -1287,7 +1408,8 @@ public function deleteDataStream($name, array $optionalArgs = []) * ``` * * @param string $name Required. Format: properties/{property_id}/firebaseLinks/{firebase_link_id} - * Example: properties/1234/firebaseLinks/5678 + * + * Example: `properties/1234/firebaseLinks/5678` * @param array $optionalArgs { * Optional. * @@ -1351,6 +1473,47 @@ public function deleteGoogleAdsLink($name, array $optionalArgs = []) return $this->startCall('DeleteGoogleAdsLink', GPBEmpty::class, $optionalArgs, $request)->wait(); } + /** + * Deletes a Key Event. + * + * Sample code: + * ``` + * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient(); + * try { + * $formattedName = $analyticsAdminServiceClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + * $analyticsAdminServiceClient->deleteKeyEvent($formattedName); + * } finally { + * $analyticsAdminServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the Key Event to delete. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteKeyEvent($name, array $optionalArgs = []) + { + $request = new DeleteKeyEventRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteKeyEvent', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + /** * Deletes target MeasurementProtocolSecret. * @@ -1399,7 +1562,7 @@ public function deleteMeasurementProtocolSecret($name, array $optionalArgs = []) * However, they can be restored using the Trash Can UI. * * If the properties are not restored before the expiration time, the Property - * and all child resources (eg: GoogleAdsLinks, Streams, UserLinks) + * and all child resources (eg: GoogleAdsLinks, Streams, AccessBindings) * will be permanently purged. * https://support.google.com/analytics/answer/6154772 * @@ -1489,6 +1652,7 @@ public function getAccount($name, array $optionalArgs = []) } /** + * Deprecated: Use `GetKeyEvent` instead. * Retrieve a single conversion event. * * Sample code: @@ -1519,6 +1683,8 @@ public function getAccount($name, array $optionalArgs = []) * @throws ApiException if the remote call fails * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function getConversionEvent($name, array $optionalArgs = []) { @@ -1676,7 +1842,8 @@ public function getDataRetentionSettings($name, array $optionalArgs = []) * * @param string $name Required. The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * + * Example: `accounts/1000/dataSharingSettings` * @param array $optionalArgs { * Optional. * @@ -1745,6 +1912,49 @@ public function getDataStream($name, array $optionalArgs = []) return $this->startCall('GetDataStream', DataStream::class, $optionalArgs, $request)->wait(); } + /** + * Retrieve a single Key Event. + * + * Sample code: + * ``` + * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient(); + * try { + * $formattedName = $analyticsAdminServiceClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + * $response = $analyticsAdminServiceClient->getKeyEvent($formattedName); + * } finally { + * $analyticsAdminServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the Key Event to retrieve. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Analytics\Admin\V1beta\KeyEvent + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getKeyEvent($name, array $optionalArgs = []) + { + $request = new GetKeyEventRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetKeyEvent', KeyEvent::class, $optionalArgs, $request)->wait(); + } + /** * Lookup for a single "GA4" MeasurementProtocolSecret. * @@ -1970,6 +2180,7 @@ public function listAccounts(array $optionalArgs = []) } /** + * Deprecated: Use `ListKeyEvents` instead. * Returns a list of conversion events in the specified parent property. * * Returns an empty list if no conversion events are found. @@ -2022,6 +2233,8 @@ public function listAccounts(array $optionalArgs = []) * @throws ApiException if the remote call fails * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function listConversionEvents($parent, array $optionalArgs = []) { @@ -2280,7 +2493,8 @@ public function listDataStreams($parent, array $optionalArgs = []) * ``` * * @param string $parent Required. Format: properties/{property_id} - * Example: properties/1234 + * + * Example: `properties/1234` * @param array $optionalArgs { * Optional. * @@ -2394,6 +2608,78 @@ public function listGoogleAdsLinks($parent, array $optionalArgs = []) return $this->getPagedListResponse('ListGoogleAdsLinks', $optionalArgs, ListGoogleAdsLinksResponse::class, $request); } + /** + * Returns a list of Key Events in the specified parent property. + * Returns an empty list if no Key Events are found. + * + * Sample code: + * ``` + * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient(); + * try { + * $formattedParent = $analyticsAdminServiceClient->propertyName('[PROPERTY]'); + * // Iterate over pages of elements + * $pagedResponse = $analyticsAdminServiceClient->listKeyEvents($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $analyticsAdminServiceClient->listKeyEvents($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $analyticsAdminServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the parent property. + * Example: 'properties/123' + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listKeyEvents($parent, array $optionalArgs = []) + { + $request = new ListKeyEventsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListKeyEvents', $optionalArgs, ListKeyEventsResponse::class, $request); + } + /** * Returns child MeasurementProtocolSecrets under the specified parent * Property. @@ -2613,8 +2899,10 @@ public function provisionAccountTicket(array $optionalArgs = []) * records of each time a user reads Google Analytics reporting data. Access * records are retained for up to 2 years. * - * Data Access Reports can be requested for a property. The property must be - * in Google Analytics 360. This method is only available to Administrators. + * Data Access Reports can be requested for a property. Reports may be + * requested for any property, but dimensions that aren't related to quota can + * only be requested on Google Analytics 360 properties. This method is only + * available to Administrators. * * These data access records include GA4 UI Reporting, GA4 UI Explorations, * GA4 Data API, and other products like Firebase & Admob that can retrieve @@ -2702,6 +2990,17 @@ public function provisionAccountTicket(array $optionalArgs = []) * Toggles whether to return the current state of this Analytics Property's * quota. Quota is returned in [AccessQuota](#AccessQuota). For account-level * requests, this field must be false. + * @type bool $includeAllUsers + * Optional. Determines whether to include users who have never made an API + * call in the response. If true, all users with access to the specified + * property or account are included in the response, regardless of whether + * they have made an API call or not. If false, only the users who have made + * an API call will be included. + * @type bool $expandGroups + * Optional. Decides whether to return the users within user groups. This + * field works only when include_all_users is set to true. If true, it will + * return all users with access to the specified property or account. + * If false, only the users with direct access will be returned. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on @@ -2763,6 +3062,14 @@ public function runAccessReport(array $optionalArgs = []) $request->setReturnEntityQuota($optionalArgs['returnEntityQuota']); } + if (isset($optionalArgs['includeAllUsers'])) { + $request->setIncludeAllUsers($optionalArgs['includeAllUsers']); + } + + if (isset($optionalArgs['expandGroups'])) { + $request->setExpandGroups($optionalArgs['expandGroups']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall('RunAccessReport', RunAccessReportResponse::class, $optionalArgs, $request)->wait(); @@ -2796,13 +3103,18 @@ public function runAccessReport(array $optionalArgs = []) * ``` * * @param string $account Required. The account resource for which to return change history - * resources. + * resources. Format: accounts/{account} + * + * Example: `accounts/100` * @param array $optionalArgs { * Optional. * * @type string $property * Optional. Resource name for a child property. If set, only return changes * made to this property or its child resources. + * Format: properties/{propertyId} + * + * Example: `properties/100` * @type int[] $resourceType * Optional. If set, only return changes if they are for a resource that * matches at least one of these types. @@ -2931,6 +3243,7 @@ public function updateAccount($account, $updateMask, array $optionalArgs = []) } /** + * Deprecated: Use `UpdateKeyEvent` instead. * Updates a conversion event with the specified attributes. * * Sample code: @@ -2965,6 +3278,8 @@ public function updateAccount($account, $updateMask, array $optionalArgs = []) * @throws ApiException if the remote call fails * * @experimental + * + * @deprecated This method will be removed in the next major version update. */ public function updateConversionEvent($conversionEvent, $updateMask, array $optionalArgs = []) { @@ -3219,6 +3534,54 @@ public function updateGoogleAdsLink($updateMask, array $optionalArgs = []) return $this->startCall('UpdateGoogleAdsLink', GoogleAdsLink::class, $optionalArgs, $request)->wait(); } + /** + * Updates a Key Event. + * + * Sample code: + * ``` + * $analyticsAdminServiceClient = new AnalyticsAdminServiceClient(); + * try { + * $keyEvent = new KeyEvent(); + * $updateMask = new FieldMask(); + * $response = $analyticsAdminServiceClient->updateKeyEvent($keyEvent, $updateMask); + * } finally { + * $analyticsAdminServiceClient->close(); + * } + * ``` + * + * @param KeyEvent $keyEvent Required. The Key Event to update. + * The `name` field is used to identify the settings to be updated. + * @param FieldMask $updateMask Required. The list of fields to be updated. Field names must be in snake + * case (e.g., "field_to_update"). Omitted fields will not be updated. To + * replace the entire entity, use one path with the string "*" to match all + * fields. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Analytics\Admin\V1beta\KeyEvent + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateKeyEvent($keyEvent, $updateMask, array $optionalArgs = []) + { + $request = new UpdateKeyEventRequest(); + $requestParamHeaders = []; + $request->setKeyEvent($keyEvent); + $request->setUpdateMask($updateMask); + $requestParamHeaders['key_event.name'] = $keyEvent->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateKeyEvent', KeyEvent::class, $optionalArgs, $request)->wait(); + } + /** * Updates a measurement protocol secret. * diff --git a/AnalyticsAdmin/src/V1beta/GetDataSharingSettingsRequest.php b/AnalyticsAdmin/src/V1beta/GetDataSharingSettingsRequest.php index 905db0278ba8..9ce593ecfbe1 100644 --- a/AnalyticsAdmin/src/V1beta/GetDataSharingSettingsRequest.php +++ b/AnalyticsAdmin/src/V1beta/GetDataSharingSettingsRequest.php @@ -18,7 +18,7 @@ class GetDataSharingSettingsRequest extends \Google\Protobuf\Internal\Message /** * Required. The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * Example: `accounts/1000/dataSharingSettings` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -27,7 +27,8 @@ class GetDataSharingSettingsRequest extends \Google\Protobuf\Internal\Message /** * @param string $name Required. The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * + * Example: `accounts/1000/dataSharingSettings` * Please see {@see AnalyticsAdminServiceClient::dataSharingSettingsName()} for help formatting this field. * * @return \Google\Analytics\Admin\V1beta\GetDataSharingSettingsRequest @@ -49,7 +50,7 @@ public static function build(string $name): self * @type string $name * Required. The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * Example: `accounts/1000/dataSharingSettings` * } */ public function __construct($data = NULL) { @@ -60,7 +61,7 @@ public function __construct($data = NULL) { /** * Required. The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * Example: `accounts/1000/dataSharingSettings` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -73,7 +74,7 @@ public function getName() /** * Required. The name of the settings to lookup. * Format: accounts/{account}/dataSharingSettings - * Example: "accounts/1000/dataSharingSettings" + * Example: `accounts/1000/dataSharingSettings` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/AnalyticsAdmin/src/V1beta/GetKeyEventRequest.php b/AnalyticsAdmin/src/V1beta/GetKeyEventRequest.php new file mode 100644 index 000000000000..e200ae64e4f1 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/GetKeyEventRequest.php @@ -0,0 +1,91 @@ +google.analytics.admin.v1beta.GetKeyEventRequest + */ +class GetKeyEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Key Event to retrieve. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * @param string $name Required. The resource name of the Key Event to retrieve. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * Please see {@see AnalyticsAdminServiceClient::keyEventName()} for help formatting this field. + * + * @return \Google\Analytics\Admin\V1beta\GetKeyEventRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Key Event to retrieve. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\AnalyticsAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Key Event to retrieve. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Key Event to retrieve. + * Format: properties/{property}/keyEvents/{key_event} + * Example: "properties/123/keyEvents/456" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/KeyEvent.php b/AnalyticsAdmin/src/V1beta/KeyEvent.php new file mode 100644 index 000000000000..eb205a6714f6 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/KeyEvent.php @@ -0,0 +1,323 @@ +google.analytics.admin.v1beta.KeyEvent + */ +class KeyEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Resource name of this key event. + * Format: properties/{property}/keyEvents/{key_event} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $name = ''; + /** + * Immutable. The event name for this key event. + * Examples: 'click', 'purchase' + * + * Generated from protobuf field string event_name = 2 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $event_name = ''; + /** + * Output only. Time when this key event was created in the property. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $create_time = null; + /** + * Output only. If set to true, this event can be deleted. + * + * Generated from protobuf field bool deletable = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $deletable = false; + /** + * Output only. If set to true, this key event refers to a custom event. If + * set to false, this key event refers to a default event in GA. Default + * events typically have special meaning in GA. Default events are usually + * created for you by the GA system, but in some cases can be created by + * property admins. Custom events count towards the maximum number of + * custom key events that may be created per property. + * + * Generated from protobuf field bool custom = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $custom = false; + /** + * Required. The method by which Key Events will be counted across multiple + * events within a session. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent.CountingMethod counting_method = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + private $counting_method = 0; + /** + * Optional. Defines a default value/currency for a key event. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent.DefaultValue default_value = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $default_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Resource name of this key event. + * Format: properties/{property}/keyEvents/{key_event} + * @type string $event_name + * Immutable. The event name for this key event. + * Examples: 'click', 'purchase' + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time when this key event was created in the property. + * @type bool $deletable + * Output only. If set to true, this event can be deleted. + * @type bool $custom + * Output only. If set to true, this key event refers to a custom event. If + * set to false, this key event refers to a default event in GA. Default + * events typically have special meaning in GA. Default events are usually + * created for you by the GA system, but in some cases can be created by + * property admins. Custom events count towards the maximum number of + * custom key events that may be created per property. + * @type int $counting_method + * Required. The method by which Key Events will be counted across multiple + * events within a session. + * @type \Google\Analytics\Admin\V1beta\KeyEvent\DefaultValue $default_value + * Optional. Defines a default value/currency for a key event. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Resource name of this key event. + * Format: properties/{property}/keyEvents/{key_event} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Resource name of this key event. + * Format: properties/{property}/keyEvents/{key_event} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Immutable. The event name for this key event. + * Examples: 'click', 'purchase' + * + * Generated from protobuf field string event_name = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getEventName() + { + return $this->event_name; + } + + /** + * Immutable. The event name for this key event. + * Examples: 'click', 'purchase' + * + * Generated from protobuf field string event_name = 2 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setEventName($var) + { + GPBUtil::checkString($var, True); + $this->event_name = $var; + + return $this; + } + + /** + * Output only. Time when this key event was created in the property. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Time when this key event was created in the property. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. If set to true, this event can be deleted. + * + * Generated from protobuf field bool deletable = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getDeletable() + { + return $this->deletable; + } + + /** + * Output only. If set to true, this event can be deleted. + * + * Generated from protobuf field bool deletable = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setDeletable($var) + { + GPBUtil::checkBool($var); + $this->deletable = $var; + + return $this; + } + + /** + * Output only. If set to true, this key event refers to a custom event. If + * set to false, this key event refers to a default event in GA. Default + * events typically have special meaning in GA. Default events are usually + * created for you by the GA system, but in some cases can be created by + * property admins. Custom events count towards the maximum number of + * custom key events that may be created per property. + * + * Generated from protobuf field bool custom = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getCustom() + { + return $this->custom; + } + + /** + * Output only. If set to true, this key event refers to a custom event. If + * set to false, this key event refers to a default event in GA. Default + * events typically have special meaning in GA. Default events are usually + * created for you by the GA system, but in some cases can be created by + * property admins. Custom events count towards the maximum number of + * custom key events that may be created per property. + * + * Generated from protobuf field bool custom = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setCustom($var) + { + GPBUtil::checkBool($var); + $this->custom = $var; + + return $this; + } + + /** + * Required. The method by which Key Events will be counted across multiple + * events within a session. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent.CountingMethod counting_method = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getCountingMethod() + { + return $this->counting_method; + } + + /** + * Required. The method by which Key Events will be counted across multiple + * events within a session. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent.CountingMethod counting_method = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setCountingMethod($var) + { + GPBUtil::checkEnum($var, \Google\Analytics\Admin\V1beta\KeyEvent\CountingMethod::class); + $this->counting_method = $var; + + return $this; + } + + /** + * Optional. Defines a default value/currency for a key event. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent.DefaultValue default_value = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Analytics\Admin\V1beta\KeyEvent\DefaultValue|null + */ + public function getDefaultValue() + { + return $this->default_value; + } + + public function hasDefaultValue() + { + return isset($this->default_value); + } + + public function clearDefaultValue() + { + unset($this->default_value); + } + + /** + * Optional. Defines a default value/currency for a key event. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent.DefaultValue default_value = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Analytics\Admin\V1beta\KeyEvent\DefaultValue $var + * @return $this + */ + public function setDefaultValue($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1beta\KeyEvent\DefaultValue::class); + $this->default_value = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/KeyEvent/CountingMethod.php b/AnalyticsAdmin/src/V1beta/KeyEvent/CountingMethod.php new file mode 100644 index 000000000000..15e03f561ab0 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/KeyEvent/CountingMethod.php @@ -0,0 +1,66 @@ +google.analytics.admin.v1beta.KeyEvent.CountingMethod + */ +class CountingMethod +{ + /** + * Counting method not specified. + * + * Generated from protobuf enum COUNTING_METHOD_UNSPECIFIED = 0; + */ + const COUNTING_METHOD_UNSPECIFIED = 0; + /** + * Each Event instance is considered a Key Event. + * + * Generated from protobuf enum ONCE_PER_EVENT = 1; + */ + const ONCE_PER_EVENT = 1; + /** + * An Event instance is considered a Key Event at most once per session per + * user. + * + * Generated from protobuf enum ONCE_PER_SESSION = 2; + */ + const ONCE_PER_SESSION = 2; + + private static $valueToName = [ + self::COUNTING_METHOD_UNSPECIFIED => 'COUNTING_METHOD_UNSPECIFIED', + self::ONCE_PER_EVENT => 'ONCE_PER_EVENT', + self::ONCE_PER_SESSION => 'ONCE_PER_SESSION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CountingMethod::class, \Google\Analytics\Admin\V1beta\KeyEvent_CountingMethod::class); + diff --git a/AnalyticsAdmin/src/V1beta/KeyEvent/DefaultValue.php b/AnalyticsAdmin/src/V1beta/KeyEvent/DefaultValue.php new file mode 100644 index 000000000000..3238b565ba96 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/KeyEvent/DefaultValue.php @@ -0,0 +1,124 @@ +google.analytics.admin.v1beta.KeyEvent.DefaultValue + */ +class DefaultValue extends \Google\Protobuf\Internal\Message +{ + /** + * Required. This will be used to populate the "value" parameter for all + * occurrences of this Key Event (specified by event_name) where that + * parameter is unset. + * + * Generated from protobuf field double numeric_value = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $numeric_value = 0.0; + /** + * Required. When an occurrence of this Key Event (specified by event_name) + * has no set currency this currency will be applied as the default. Must be + * in ISO 4217 currency code format. + * See https://en.wikipedia.org/wiki/ISO_4217 for more information. + * + * Generated from protobuf field string currency_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $currency_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $numeric_value + * Required. This will be used to populate the "value" parameter for all + * occurrences of this Key Event (specified by event_name) where that + * parameter is unset. + * @type string $currency_code + * Required. When an occurrence of this Key Event (specified by event_name) + * has no set currency this currency will be applied as the default. Must be + * in ISO 4217 currency code format. + * See https://en.wikipedia.org/wiki/ISO_4217 for more information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. This will be used to populate the "value" parameter for all + * occurrences of this Key Event (specified by event_name) where that + * parameter is unset. + * + * Generated from protobuf field double numeric_value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getNumericValue() + { + return $this->numeric_value; + } + + /** + * Required. This will be used to populate the "value" parameter for all + * occurrences of this Key Event (specified by event_name) where that + * parameter is unset. + * + * Generated from protobuf field double numeric_value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setNumericValue($var) + { + GPBUtil::checkDouble($var); + $this->numeric_value = $var; + + return $this; + } + + /** + * Required. When an occurrence of this Key Event (specified by event_name) + * has no set currency this currency will be applied as the default. Must be + * in ISO 4217 currency code format. + * See https://en.wikipedia.org/wiki/ISO_4217 for more information. + * + * Generated from protobuf field string currency_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCurrencyCode() + { + return $this->currency_code; + } + + /** + * Required. When an occurrence of this Key Event (specified by event_name) + * has no set currency this currency will be applied as the default. Must be + * in ISO 4217 currency code format. + * See https://en.wikipedia.org/wiki/ISO_4217 for more information. + * + * Generated from protobuf field string currency_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCurrencyCode($var) + { + GPBUtil::checkString($var, True); + $this->currency_code = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DefaultValue::class, \Google\Analytics\Admin\V1beta\KeyEvent_DefaultValue::class); + diff --git a/AnalyticsAdmin/src/V1beta/ListFirebaseLinksRequest.php b/AnalyticsAdmin/src/V1beta/ListFirebaseLinksRequest.php index fb599f6c2ca2..50026f5f4efd 100644 --- a/AnalyticsAdmin/src/V1beta/ListFirebaseLinksRequest.php +++ b/AnalyticsAdmin/src/V1beta/ListFirebaseLinksRequest.php @@ -17,7 +17,7 @@ class ListFirebaseLinksRequest extends \Google\Protobuf\Internal\Message { /** * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -43,7 +43,8 @@ class ListFirebaseLinksRequest extends \Google\Protobuf\Internal\Message /** * @param string $parent Required. Format: properties/{property_id} - * Example: properties/1234 + * + * Example: `properties/1234` * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field. * * @return \Google\Analytics\Admin\V1beta\ListFirebaseLinksRequest @@ -64,7 +65,7 @@ public static function build(string $parent): self * * @type string $parent * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * @type int $page_size * The maximum number of resources to return. The service may return * fewer than this value, even if there are additional pages. @@ -84,7 +85,7 @@ public function __construct($data = NULL) { /** * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -96,7 +97,7 @@ public function getParent() /** * Required. Format: properties/{property_id} - * Example: properties/1234 + * Example: `properties/1234` * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/AnalyticsAdmin/src/V1beta/ListKeyEventsRequest.php b/AnalyticsAdmin/src/V1beta/ListKeyEventsRequest.php new file mode 100644 index 000000000000..47d226572a8c --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/ListKeyEventsRequest.php @@ -0,0 +1,174 @@ +google.analytics.admin.v1beta.ListKeyEventsRequest + */ +class ListKeyEventsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the parent property. + * Example: 'properties/123' + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * A page token, received from a previous `ListKeyEvents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListKeyEvents` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * @param string $parent Required. The resource name of the parent property. + * Example: 'properties/123' + * Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field. + * + * @return \Google\Analytics\Admin\V1beta\ListKeyEventsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the parent property. + * Example: 'properties/123' + * @type int $page_size + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * @type string $page_token + * A page token, received from a previous `ListKeyEvents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListKeyEvents` + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\AnalyticsAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the parent property. + * Example: 'properties/123' + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the parent property. + * Example: 'properties/123' + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of resources to return. + * If unspecified, at most 50 resources will be returned. + * The maximum value is 200; (higher values will be coerced to the maximum) + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListKeyEvents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListKeyEvents` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListKeyEvents` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListKeyEvents` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/ListKeyEventsResponse.php b/AnalyticsAdmin/src/V1beta/ListKeyEventsResponse.php new file mode 100644 index 000000000000..88a54b6184cf --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/ListKeyEventsResponse.php @@ -0,0 +1,105 @@ +google.analytics.admin.v1beta.ListKeyEventsResponse + */ +class ListKeyEventsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The requested Key Events + * + * Generated from protobuf field repeated .google.analytics.admin.v1beta.KeyEvent key_events = 1; + */ + private $key_events; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Analytics\Admin\V1beta\KeyEvent>|\Google\Protobuf\Internal\RepeatedField $key_events + * The requested Key Events + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\AnalyticsAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The requested Key Events + * + * Generated from protobuf field repeated .google.analytics.admin.v1beta.KeyEvent key_events = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKeyEvents() + { + return $this->key_events; + } + + /** + * The requested Key Events + * + * Generated from protobuf field repeated .google.analytics.admin.v1beta.KeyEvent key_events = 1; + * @param array<\Google\Analytics\Admin\V1beta\KeyEvent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKeyEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Analytics\Admin\V1beta\KeyEvent::class); + $this->key_events = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/Property.php b/AnalyticsAdmin/src/V1beta/Property.php index 4c4492e3da5b..846cf2bc3621 100644 --- a/AnalyticsAdmin/src/V1beta/Property.php +++ b/AnalyticsAdmin/src/V1beta/Property.php @@ -26,8 +26,7 @@ class Property extends \Google\Protobuf\Internal\Message /** * Immutable. The property type for this Property resource. When creating a * property, if the type is "PROPERTY_TYPE_UNSPECIFIED", then - * "ORDINARY_PROPERTY" will be implied. "SUBPROPERTY" and "ROLLUP_PROPERTY" - * types cannot yet be created with the Google Analytics Admin API. + * "ORDINARY_PROPERTY" will be implied. * * Generated from protobuf field .google.analytics.admin.v1beta.PropertyType property_type = 14 [(.google.api.field_behavior) = IMMUTABLE]; */ @@ -131,8 +130,7 @@ class Property extends \Google\Protobuf\Internal\Message * @type int $property_type * Immutable. The property type for this Property resource. When creating a * property, if the type is "PROPERTY_TYPE_UNSPECIFIED", then - * "ORDINARY_PROPERTY" will be implied. "SUBPROPERTY" and "ROLLUP_PROPERTY" - * types cannot yet be created with the Google Analytics Admin API. + * "ORDINARY_PROPERTY" will be implied. * @type \Google\Protobuf\Timestamp $create_time * Output only. Time when the entity was originally created. * @type \Google\Protobuf\Timestamp $update_time @@ -214,8 +212,7 @@ public function setName($var) /** * Immutable. The property type for this Property resource. When creating a * property, if the type is "PROPERTY_TYPE_UNSPECIFIED", then - * "ORDINARY_PROPERTY" will be implied. "SUBPROPERTY" and "ROLLUP_PROPERTY" - * types cannot yet be created with the Google Analytics Admin API. + * "ORDINARY_PROPERTY" will be implied. * * Generated from protobuf field .google.analytics.admin.v1beta.PropertyType property_type = 14 [(.google.api.field_behavior) = IMMUTABLE]; * @return int @@ -228,8 +225,7 @@ public function getPropertyType() /** * Immutable. The property type for this Property resource. When creating a * property, if the type is "PROPERTY_TYPE_UNSPECIFIED", then - * "ORDINARY_PROPERTY" will be implied. "SUBPROPERTY" and "ROLLUP_PROPERTY" - * types cannot yet be created with the Google Analytics Admin API. + * "ORDINARY_PROPERTY" will be implied. * * Generated from protobuf field .google.analytics.admin.v1beta.PropertyType property_type = 14 [(.google.api.field_behavior) = IMMUTABLE]; * @param int $var diff --git a/AnalyticsAdmin/src/V1beta/RunAccessReportRequest.php b/AnalyticsAdmin/src/V1beta/RunAccessReportRequest.php index b2d303a851f0..9cf69e83a0a6 100644 --- a/AnalyticsAdmin/src/V1beta/RunAccessReportRequest.php +++ b/AnalyticsAdmin/src/V1beta/RunAccessReportRequest.php @@ -120,6 +120,25 @@ class RunAccessReportRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool return_entity_quota = 11; */ private $return_entity_quota = false; + /** + * Optional. Determines whether to include users who have never made an API + * call in the response. If true, all users with access to the specified + * property or account are included in the response, regardless of whether + * they have made an API call or not. If false, only the users who have made + * an API call will be included. + * + * Generated from protobuf field bool include_all_users = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $include_all_users = false; + /** + * Optional. Decides whether to return the users within user groups. This + * field works only when include_all_users is set to true. If true, it will + * return all users with access to the specified property or account. + * If false, only the users with direct access will be returned. + * + * Generated from protobuf field bool expand_groups = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $expand_groups = false; /** * Constructor. @@ -188,6 +207,17 @@ class RunAccessReportRequest extends \Google\Protobuf\Internal\Message * Toggles whether to return the current state of this Analytics Property's * quota. Quota is returned in [AccessQuota](#AccessQuota). For account-level * requests, this field must be false. + * @type bool $include_all_users + * Optional. Determines whether to include users who have never made an API + * call in the response. If true, all users with access to the specified + * property or account are included in the response, regardless of whether + * they have made an API call or not. If false, only the users who have made + * an API call will be included. + * @type bool $expand_groups + * Optional. Decides whether to return the users within user groups. This + * field works only when include_all_users is set to true. If true, it will + * return all users with access to the specified property or account. + * If false, only the users with direct access will be returned. * } */ public function __construct($data = NULL) { @@ -579,5 +609,71 @@ public function setReturnEntityQuota($var) return $this; } + /** + * Optional. Determines whether to include users who have never made an API + * call in the response. If true, all users with access to the specified + * property or account are included in the response, regardless of whether + * they have made an API call or not. If false, only the users who have made + * an API call will be included. + * + * Generated from protobuf field bool include_all_users = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIncludeAllUsers() + { + return $this->include_all_users; + } + + /** + * Optional. Determines whether to include users who have never made an API + * call in the response. If true, all users with access to the specified + * property or account are included in the response, regardless of whether + * they have made an API call or not. If false, only the users who have made + * an API call will be included. + * + * Generated from protobuf field bool include_all_users = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIncludeAllUsers($var) + { + GPBUtil::checkBool($var); + $this->include_all_users = $var; + + return $this; + } + + /** + * Optional. Decides whether to return the users within user groups. This + * field works only when include_all_users is set to true. If true, it will + * return all users with access to the specified property or account. + * If false, only the users with direct access will be returned. + * + * Generated from protobuf field bool expand_groups = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExpandGroups() + { + return $this->expand_groups; + } + + /** + * Optional. Decides whether to return the users within user groups. This + * field works only when include_all_users is set to true. If true, it will + * return all users with access to the specified property or account. + * If false, only the users with direct access will be returned. + * + * Generated from protobuf field bool expand_groups = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExpandGroups($var) + { + GPBUtil::checkBool($var); + $this->expand_groups = $var; + + return $this; + } + } diff --git a/AnalyticsAdmin/src/V1beta/SearchChangeHistoryEventsRequest.php b/AnalyticsAdmin/src/V1beta/SearchChangeHistoryEventsRequest.php index 01873fa4290b..d3f69b090c9c 100644 --- a/AnalyticsAdmin/src/V1beta/SearchChangeHistoryEventsRequest.php +++ b/AnalyticsAdmin/src/V1beta/SearchChangeHistoryEventsRequest.php @@ -17,7 +17,8 @@ class SearchChangeHistoryEventsRequest extends \Google\Protobuf\Internal\Message { /** * Required. The account resource for which to return change history - * resources. + * resources. Format: accounts/{account} + * Example: `accounts/100` * * Generated from protobuf field string account = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -25,6 +26,8 @@ class SearchChangeHistoryEventsRequest extends \Google\Protobuf\Internal\Message /** * Optional. Resource name for a child property. If set, only return changes * made to this property or its child resources. + * Format: properties/{propertyId} + * Example: `properties/100` * * Generated from protobuf field string property = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ @@ -90,10 +93,13 @@ class SearchChangeHistoryEventsRequest extends \Google\Protobuf\Internal\Message * * @type string $account * Required. The account resource for which to return change history - * resources. + * resources. Format: accounts/{account} + * Example: `accounts/100` * @type string $property * Optional. Resource name for a child property. If set, only return changes * made to this property or its child resources. + * Format: properties/{propertyId} + * Example: `properties/100` * @type array|\Google\Protobuf\Internal\RepeatedField $resource_type * Optional. If set, only return changes if they are for a resource that * matches at least one of these types. @@ -127,7 +133,8 @@ public function __construct($data = NULL) { /** * Required. The account resource for which to return change history - * resources. + * resources. Format: accounts/{account} + * Example: `accounts/100` * * Generated from protobuf field string account = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -139,7 +146,8 @@ public function getAccount() /** * Required. The account resource for which to return change history - * resources. + * resources. Format: accounts/{account} + * Example: `accounts/100` * * Generated from protobuf field string account = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var @@ -156,6 +164,8 @@ public function setAccount($var) /** * Optional. Resource name for a child property. If set, only return changes * made to this property or its child resources. + * Format: properties/{propertyId} + * Example: `properties/100` * * Generated from protobuf field string property = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string @@ -168,6 +178,8 @@ public function getProperty() /** * Optional. Resource name for a child property. If set, only return changes * made to this property or its child resources. + * Format: properties/{propertyId} + * Example: `properties/100` * * Generated from protobuf field string property = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var diff --git a/AnalyticsAdmin/src/V1beta/UpdateKeyEventRequest.php b/AnalyticsAdmin/src/V1beta/UpdateKeyEventRequest.php new file mode 100644 index 000000000000..3cb22723b7d7 --- /dev/null +++ b/AnalyticsAdmin/src/V1beta/UpdateKeyEventRequest.php @@ -0,0 +1,156 @@ +google.analytics.admin.v1beta.UpdateKeyEventRequest + */ +class UpdateKeyEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Key Event to update. + * The `name` field is used to identify the settings to be updated. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent key_event = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $key_event = null; + /** + * Required. The list of fields to be updated. Field names must be in snake + * case (e.g., "field_to_update"). Omitted fields will not be updated. To + * replace the entire entity, use one path with the string "*" to match all + * fields. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $update_mask = null; + + /** + * @param \Google\Analytics\Admin\V1beta\KeyEvent $keyEvent Required. The Key Event to update. + * The `name` field is used to identify the settings to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. The list of fields to be updated. Field names must be in snake + * case (e.g., "field_to_update"). Omitted fields will not be updated. To + * replace the entire entity, use one path with the string "*" to match all + * fields. + * + * @return \Google\Analytics\Admin\V1beta\UpdateKeyEventRequest + * + * @experimental + */ + public static function build(\Google\Analytics\Admin\V1beta\KeyEvent $keyEvent, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setKeyEvent($keyEvent) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Analytics\Admin\V1beta\KeyEvent $key_event + * Required. The Key Event to update. + * The `name` field is used to identify the settings to be updated. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The list of fields to be updated. Field names must be in snake + * case (e.g., "field_to_update"). Omitted fields will not be updated. To + * replace the entire entity, use one path with the string "*" to match all + * fields. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Analytics\Admin\V1Beta\AnalyticsAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Key Event to update. + * The `name` field is used to identify the settings to be updated. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent key_event = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Analytics\Admin\V1beta\KeyEvent|null + */ + public function getKeyEvent() + { + return $this->key_event; + } + + public function hasKeyEvent() + { + return isset($this->key_event); + } + + public function clearKeyEvent() + { + unset($this->key_event); + } + + /** + * Required. The Key Event to update. + * The `name` field is used to identify the settings to be updated. + * + * Generated from protobuf field .google.analytics.admin.v1beta.KeyEvent key_event = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Analytics\Admin\V1beta\KeyEvent $var + * @return $this + */ + public function setKeyEvent($var) + { + GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1beta\KeyEvent::class); + $this->key_event = $var; + + return $this; + } + + /** + * Required. The list of fields to be updated. Field names must be in snake + * case (e.g., "field_to_update"). Omitted fields will not be updated. To + * replace the entire entity, use one path with the string "*" to match all + * fields. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The list of fields to be updated. Field names must be in snake + * case (e.g., "field_to_update"). Omitted fields will not be updated. To + * replace the entire entity, use one path with the string "*" to match all + * fields. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/AnalyticsAdmin/src/V1beta/gapic_metadata.json b/AnalyticsAdmin/src/V1beta/gapic_metadata.json index 3f81008d639d..598ade2f6653 100644 --- a/AnalyticsAdmin/src/V1beta/gapic_metadata.json +++ b/AnalyticsAdmin/src/V1beta/gapic_metadata.json @@ -55,6 +55,11 @@ "createGoogleAdsLink" ] }, + "CreateKeyEvent": { + "methods": [ + "createKeyEvent" + ] + }, "CreateMeasurementProtocolSecret": { "methods": [ "createMeasurementProtocolSecret" @@ -90,6 +95,11 @@ "deleteGoogleAdsLink" ] }, + "DeleteKeyEvent": { + "methods": [ + "deleteKeyEvent" + ] + }, "DeleteMeasurementProtocolSecret": { "methods": [ "deleteMeasurementProtocolSecret" @@ -135,6 +145,11 @@ "getDataStream" ] }, + "GetKeyEvent": { + "methods": [ + "getKeyEvent" + ] + }, "GetMeasurementProtocolSecret": { "methods": [ "getMeasurementProtocolSecret" @@ -185,6 +200,11 @@ "listGoogleAdsLinks" ] }, + "ListKeyEvents": { + "methods": [ + "listKeyEvents" + ] + }, "ListMeasurementProtocolSecrets": { "methods": [ "listMeasurementProtocolSecrets" @@ -245,6 +265,11 @@ "updateGoogleAdsLink" ] }, + "UpdateKeyEvent": { + "methods": [ + "updateKeyEvent" + ] + }, "UpdateMeasurementProtocolSecret": { "methods": [ "updateMeasurementProtocolSecret" diff --git a/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_client_config.json b/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_client_config.json index 0ddd065aba14..e546f6c5e3fa 100644 --- a/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_client_config.json +++ b/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_client_config.json @@ -74,6 +74,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "CreateKeyEvent": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "CreateMeasurementProtocolSecret": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", @@ -109,6 +114,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "DeleteKeyEvent": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "DeleteMeasurementProtocolSecret": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", @@ -154,6 +164,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "GetKeyEvent": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GetMeasurementProtocolSecret": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", @@ -204,6 +219,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "ListKeyEvents": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "ListMeasurementProtocolSecrets": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", @@ -264,6 +284,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "UpdateKeyEvent": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "UpdateMeasurementProtocolSecret": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", diff --git a/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_descriptor_config.php b/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_descriptor_config.php index 2154e952b08f..e027543ee25f 100644 --- a/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_descriptor_config.php +++ b/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_descriptor_config.php @@ -131,6 +131,18 @@ ], ], ], + 'CreateKeyEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Analytics\Admin\V1beta\KeyEvent', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'CreateMeasurementProtocolSecret' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Analytics\Admin\V1beta\MeasurementProtocolSecret', @@ -207,6 +219,18 @@ ], ], ], + 'DeleteKeyEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'DeleteMeasurementProtocolSecret' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Protobuf\GPBEmpty', @@ -315,6 +339,18 @@ ], ], ], + 'GetKeyEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Analytics\Admin\V1beta\KeyEvent', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'GetMeasurementProtocolSecret' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Analytics\Admin\V1beta\MeasurementProtocolSecret', @@ -483,6 +519,26 @@ ], ], ], + 'ListKeyEvents' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getKeyEvents', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Analytics\Admin\V1beta\ListKeyEventsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'ListMeasurementProtocolSecrets' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -642,6 +698,19 @@ ], ], ], + 'UpdateKeyEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Analytics\Admin\V1beta\KeyEvent', + 'headerParams' => [ + [ + 'keyName' => 'key_event.name', + 'fieldAccessors' => [ + 'getKeyEvent', + 'getName', + ], + ], + ], + ], 'UpdateMeasurementProtocolSecret' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Analytics\Admin\V1beta\MeasurementProtocolSecret', @@ -678,7 +747,9 @@ 'dataStream' => 'properties/{property}/dataStreams/{data_stream}', 'firebaseLink' => 'properties/{property}/firebaseLinks/{firebase_link}', 'googleAdsLink' => 'properties/{property}/googleAdsLinks/{google_ads_link}', + 'keyEvent' => 'properties/{property}/keyEvents/{key_event}', 'measurementProtocolSecret' => 'properties/{property}/dataStreams/{data_stream}/measurementProtocolSecrets/{measurement_protocol_secret}', + 'organization' => 'organizations/{organization}', 'property' => 'properties/{property}', ], ], diff --git a/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_rest_client_config.php b/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_rest_client_config.php index e399e20438f3..f2577d36ac94 100644 --- a/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_rest_client_config.php +++ b/AnalyticsAdmin/src/V1beta/resources/analytics_admin_service_rest_client_config.php @@ -131,6 +131,18 @@ ], ], ], + 'CreateKeyEvent' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=properties/*}/keyEvents', + 'body' => 'key_event', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'CreateMeasurementProtocolSecret' => [ 'method' => 'post', 'uriTemplate' => '/v1beta/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets', @@ -203,6 +215,17 @@ ], ], ], + 'DeleteKeyEvent' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=properties/*/keyEvents/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'DeleteMeasurementProtocolSecret' => [ 'method' => 'delete', 'uriTemplate' => '/v1beta/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}', @@ -302,6 +325,17 @@ ], ], ], + 'GetKeyEvent' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=properties/*/keyEvents/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetMeasurementProtocolSecret' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}', @@ -398,6 +432,17 @@ ], ], ], + 'ListKeyEvents' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=properties/*}/keyEvents', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'ListMeasurementProtocolSecrets' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets', @@ -564,6 +609,22 @@ 'update_mask', ], ], + 'UpdateKeyEvent' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{key_event.name=properties/*/keyEvents/*}', + 'body' => 'key_event', + 'placeholders' => [ + 'key_event.name' => [ + 'getters' => [ + 'getKeyEvent', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], 'UpdateMeasurementProtocolSecret' => [ 'method' => 'patch', 'uriTemplate' => '/v1beta/{measurement_protocol_secret.name=properties/*/dataStreams/*/measurementProtocolSecrets/*}', diff --git a/AnalyticsAdmin/tests/Unit/V1beta/AnalyticsAdminServiceClientTest.php b/AnalyticsAdmin/tests/Unit/V1beta/AnalyticsAdminServiceClientTest.php index cb908f25d8ca..668c29e124b6 100644 --- a/AnalyticsAdmin/tests/Unit/V1beta/AnalyticsAdminServiceClientTest.php +++ b/AnalyticsAdmin/tests/Unit/V1beta/AnalyticsAdminServiceClientTest.php @@ -39,6 +39,8 @@ use Google\Analytics\Admin\V1beta\DataStream\DataStreamType; use Google\Analytics\Admin\V1beta\FirebaseLink; use Google\Analytics\Admin\V1beta\GoogleAdsLink; +use Google\Analytics\Admin\V1beta\KeyEvent; +use Google\Analytics\Admin\V1beta\KeyEvent\CountingMethod; use Google\Analytics\Admin\V1beta\ListAccountSummariesResponse; use Google\Analytics\Admin\V1beta\ListAccountsResponse; use Google\Analytics\Admin\V1beta\ListConversionEventsResponse; @@ -47,6 +49,7 @@ use Google\Analytics\Admin\V1beta\ListDataStreamsResponse; use Google\Analytics\Admin\V1beta\ListFirebaseLinksResponse; use Google\Analytics\Admin\V1beta\ListGoogleAdsLinksResponse; +use Google\Analytics\Admin\V1beta\ListKeyEventsResponse; use Google\Analytics\Admin\V1beta\ListMeasurementProtocolSecretsResponse; use Google\Analytics\Admin\V1beta\ListPropertiesResponse; use Google\Analytics\Admin\V1beta\MeasurementProtocolSecret; @@ -713,6 +716,80 @@ public function createGoogleAdsLinkExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function createKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $eventName = 'eventName984174864'; + $deletable = true; + $custom = false; + $expectedResponse = new KeyEvent(); + $expectedResponse->setName($name); + $expectedResponse->setEventName($eventName); + $expectedResponse->setDeletable($deletable); + $expectedResponse->setCustom($custom); + $transport->addResponse($expectedResponse); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + $response = $gapicClient->createKeyEvent($keyEvent, $formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/CreateKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getKeyEvent(); + $this->assertProtobufEquals($keyEvent, $actualValue); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + try { + $gapicClient->createKeyEvent($keyEvent, $formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function createMeasurementProtocolSecretTest() { @@ -1148,6 +1225,63 @@ public function deleteGoogleAdsLinkExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function deleteKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + $gapicClient->deleteKeyEvent($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/DeleteKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + try { + $gapicClient->deleteKeyEvent($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function deleteMeasurementProtocolSecretTest() { @@ -1288,11 +1422,13 @@ public function getAccountTest() $displayName = 'displayName1615086568'; $regionCode = 'regionCode-1566082984'; $deleted = false; + $gmpOrganization = 'gmpOrganization-1643573496'; $expectedResponse = new Account(); $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setRegionCode($regionCode); $expectedResponse->setDeleted($deleted); + $expectedResponse->setGmpOrganization($gmpOrganization); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->accountName('[ACCOUNT]'); @@ -1735,6 +1871,72 @@ public function getDataStreamExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $eventName = 'eventName984174864'; + $deletable = true; + $custom = false; + $expectedResponse = new KeyEvent(); + $expectedResponse->setName($name2); + $expectedResponse->setEventName($eventName); + $expectedResponse->setDeletable($deletable); + $expectedResponse->setCustom($custom); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + $response = $gapicClient->getKeyEvent($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/GetKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + try { + $gapicClient->getKeyEvent($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function getMeasurementProtocolSecretTest() { @@ -2401,6 +2603,74 @@ public function listGoogleAdsLinksExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listKeyEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $keyEventsElement = new KeyEvent(); + $keyEvents = [ + $keyEventsElement, + ]; + $expectedResponse = new ListKeyEventsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setKeyEvents($keyEvents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + $response = $gapicClient->listKeyEvents($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getKeyEvents()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/ListKeyEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listKeyEventsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + try { + $gapicClient->listKeyEvents($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function listMeasurementProtocolSecretsTest() { @@ -2726,11 +2996,13 @@ public function updateAccountTest() $displayName = 'displayName1615086568'; $regionCode = 'regionCode-1566082984'; $deleted = false; + $gmpOrganization = 'gmpOrganization-1643573496'; $expectedResponse = new Account(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setRegionCode($regionCode); $expectedResponse->setDeleted($deleted); + $expectedResponse->setGmpOrganization($gmpOrganization); $transport->addResponse($expectedResponse); // Mock request $account = new Account(); @@ -3185,6 +3457,80 @@ public function updateGoogleAdsLinkExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function updateKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $eventName = 'eventName984174864'; + $deletable = true; + $custom = false; + $expectedResponse = new KeyEvent(); + $expectedResponse->setName($name); + $expectedResponse->setEventName($eventName); + $expectedResponse->setDeletable($deletable); + $expectedResponse->setCustom($custom); + $transport->addResponse($expectedResponse); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $updateMask = new FieldMask(); + $response = $gapicClient->updateKeyEvent($keyEvent, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/UpdateKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getKeyEvent(); + $this->assertProtobufEquals($keyEvent, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $updateMask = new FieldMask(); + try { + $gapicClient->updateKeyEvent($keyEvent, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function updateMeasurementProtocolSecretTest() { diff --git a/AnalyticsAdmin/tests/Unit/V1beta/Client/AnalyticsAdminServiceClientTest.php b/AnalyticsAdmin/tests/Unit/V1beta/Client/AnalyticsAdminServiceClientTest.php index 0e9574c4843e..1e0ea8704ea9 100644 --- a/AnalyticsAdmin/tests/Unit/V1beta/Client/AnalyticsAdminServiceClientTest.php +++ b/AnalyticsAdmin/tests/Unit/V1beta/Client/AnalyticsAdminServiceClientTest.php @@ -37,6 +37,7 @@ use Google\Analytics\Admin\V1beta\CreateDataStreamRequest; use Google\Analytics\Admin\V1beta\CreateFirebaseLinkRequest; use Google\Analytics\Admin\V1beta\CreateGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\CreateKeyEventRequest; use Google\Analytics\Admin\V1beta\CreateMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\CreatePropertyRequest; use Google\Analytics\Admin\V1beta\CustomDimension; @@ -53,6 +54,7 @@ use Google\Analytics\Admin\V1beta\DeleteDataStreamRequest; use Google\Analytics\Admin\V1beta\DeleteFirebaseLinkRequest; use Google\Analytics\Admin\V1beta\DeleteGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\DeleteKeyEventRequest; use Google\Analytics\Admin\V1beta\DeleteMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\DeletePropertyRequest; use Google\Analytics\Admin\V1beta\FirebaseLink; @@ -63,9 +65,12 @@ use Google\Analytics\Admin\V1beta\GetDataRetentionSettingsRequest; use Google\Analytics\Admin\V1beta\GetDataSharingSettingsRequest; use Google\Analytics\Admin\V1beta\GetDataStreamRequest; +use Google\Analytics\Admin\V1beta\GetKeyEventRequest; use Google\Analytics\Admin\V1beta\GetMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\GetPropertyRequest; use Google\Analytics\Admin\V1beta\GoogleAdsLink; +use Google\Analytics\Admin\V1beta\KeyEvent; +use Google\Analytics\Admin\V1beta\KeyEvent\CountingMethod; use Google\Analytics\Admin\V1beta\ListAccountSummariesRequest; use Google\Analytics\Admin\V1beta\ListAccountSummariesResponse; use Google\Analytics\Admin\V1beta\ListAccountsRequest; @@ -82,6 +87,8 @@ use Google\Analytics\Admin\V1beta\ListFirebaseLinksResponse; use Google\Analytics\Admin\V1beta\ListGoogleAdsLinksRequest; use Google\Analytics\Admin\V1beta\ListGoogleAdsLinksResponse; +use Google\Analytics\Admin\V1beta\ListKeyEventsRequest; +use Google\Analytics\Admin\V1beta\ListKeyEventsResponse; use Google\Analytics\Admin\V1beta\ListMeasurementProtocolSecretsRequest; use Google\Analytics\Admin\V1beta\ListMeasurementProtocolSecretsResponse; use Google\Analytics\Admin\V1beta\ListPropertiesRequest; @@ -101,6 +108,7 @@ use Google\Analytics\Admin\V1beta\UpdateDataRetentionSettingsRequest; use Google\Analytics\Admin\V1beta\UpdateDataStreamRequest; use Google\Analytics\Admin\V1beta\UpdateGoogleAdsLinkRequest; +use Google\Analytics\Admin\V1beta\UpdateKeyEventRequest; use Google\Analytics\Admin\V1beta\UpdateMeasurementProtocolSecretRequest; use Google\Analytics\Admin\V1beta\UpdatePropertyRequest; use Google\ApiCore\ApiException; @@ -812,6 +820,86 @@ public function createGoogleAdsLinkExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function createKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $eventName = 'eventName984174864'; + $deletable = true; + $custom = false; + $expectedResponse = new KeyEvent(); + $expectedResponse->setName($name); + $expectedResponse->setEventName($eventName); + $expectedResponse->setDeletable($deletable); + $expectedResponse->setCustom($custom); + $transport->addResponse($expectedResponse); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + $request = (new CreateKeyEventRequest()) + ->setKeyEvent($keyEvent) + ->setParent($formattedParent); + $response = $gapicClient->createKeyEvent($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/CreateKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getKeyEvent(); + $this->assertProtobufEquals($keyEvent, $actualValue); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + $request = (new CreateKeyEventRequest()) + ->setKeyEvent($keyEvent) + ->setParent($formattedParent); + try { + $gapicClient->createKeyEvent($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function createMeasurementProtocolSecretTest() { @@ -1277,6 +1365,67 @@ public function deleteGoogleAdsLinkExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function deleteKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + $request = (new DeleteKeyEventRequest()) + ->setName($formattedName); + $gapicClient->deleteKeyEvent($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/DeleteKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + $request = (new DeleteKeyEventRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteKeyEvent($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function deleteMeasurementProtocolSecretTest() { @@ -1425,11 +1574,13 @@ public function getAccountTest() $displayName = 'displayName1615086568'; $regionCode = 'regionCode-1566082984'; $deleted = false; + $gmpOrganization = 'gmpOrganization-1643573496'; $expectedResponse = new Account(); $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setRegionCode($regionCode); $expectedResponse->setDeleted($deleted); + $expectedResponse->setGmpOrganization($gmpOrganization); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->accountName('[ACCOUNT]'); @@ -1900,6 +2051,76 @@ public function getDataStreamExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $eventName = 'eventName984174864'; + $deletable = true; + $custom = false; + $expectedResponse = new KeyEvent(); + $expectedResponse->setName($name2); + $expectedResponse->setEventName($eventName); + $expectedResponse->setDeletable($deletable); + $expectedResponse->setCustom($custom); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + $request = (new GetKeyEventRequest()) + ->setName($formattedName); + $response = $gapicClient->getKeyEvent($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/GetKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->keyEventName('[PROPERTY]', '[KEY_EVENT]'); + $request = (new GetKeyEventRequest()) + ->setName($formattedName); + try { + $gapicClient->getKeyEvent($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function getMeasurementProtocolSecretTest() { @@ -2602,6 +2823,78 @@ public function listGoogleAdsLinksExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listKeyEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $keyEventsElement = new KeyEvent(); + $keyEvents = [ + $keyEventsElement, + ]; + $expectedResponse = new ListKeyEventsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setKeyEvents($keyEvents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + $request = (new ListKeyEventsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listKeyEvents($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getKeyEvents()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/ListKeyEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listKeyEventsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->propertyName('[PROPERTY]'); + $request = (new ListKeyEventsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listKeyEvents($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function listMeasurementProtocolSecretsTest() { @@ -2943,11 +3236,13 @@ public function updateAccountTest() $displayName = 'displayName1615086568'; $regionCode = 'regionCode-1566082984'; $deleted = false; + $gmpOrganization = 'gmpOrganization-1643573496'; $expectedResponse = new Account(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setRegionCode($regionCode); $expectedResponse->setDeleted($deleted); + $expectedResponse->setGmpOrganization($gmpOrganization); $transport->addResponse($expectedResponse); // Mock request $account = new Account(); @@ -3436,6 +3731,86 @@ public function updateGoogleAdsLinkExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function updateKeyEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $eventName = 'eventName984174864'; + $deletable = true; + $custom = false; + $expectedResponse = new KeyEvent(); + $expectedResponse->setName($name); + $expectedResponse->setEventName($eventName); + $expectedResponse->setDeletable($deletable); + $expectedResponse->setCustom($custom); + $transport->addResponse($expectedResponse); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $updateMask = new FieldMask(); + $request = (new UpdateKeyEventRequest()) + ->setKeyEvent($keyEvent) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateKeyEvent($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.analytics.admin.v1beta.AnalyticsAdminService/UpdateKeyEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getKeyEvent(); + $this->assertProtobufEquals($keyEvent, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateKeyEventExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $keyEvent = new KeyEvent(); + $keyEventCountingMethod = CountingMethod::COUNTING_METHOD_UNSPECIFIED; + $keyEvent->setCountingMethod($keyEventCountingMethod); + $updateMask = new FieldMask(); + $request = (new UpdateKeyEventRequest()) + ->setKeyEvent($keyEvent) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateKeyEvent($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function updateMeasurementProtocolSecretTest() {