Skip to content

Commit

Permalink
fix: [AnalyticsAdmin] CustomDimension and CustomMetric resource confi…
Browse files Browse the repository at this point in the history
…guration in Analytics Admin API (#5270)

* fix: CustomDimension and CustomMetric resource configuration in Analytics Admin API

PiperOrigin-RevId: 448304423

Source-Link: googleapis/googleapis@d018d54

Source-Link: googleapis/googleapis-gen@6c363ee
Copy-Tag: eyJwIjoiQW5hbHl0aWNzQWRtaW4vLk93bEJvdC55YW1sIiwiaCI6IjZjMzYzZWVhMGY5OWQwMGEyMTZhNGVmYzgwMTVlNjkyNzJjY2FhODMifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed May 12, 2022
1 parent 8c40b7e commit b106d7e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
Binary file modified AnalyticsAdmin/metadata/V1Alpha/Resources.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private static function getConversionEventNameTemplate()
private static function getCustomDimensionNameTemplate()
{
if (self::$customDimensionNameTemplate == null) {
self::$customDimensionNameTemplate = new PathTemplate('properties/{property}/customDimensions');
self::$customDimensionNameTemplate = new PathTemplate('properties/{property}/customDimensions/{custom_dimension}');
}

return self::$customDimensionNameTemplate;
Expand All @@ -303,7 +303,7 @@ private static function getCustomDimensionNameTemplate()
private static function getCustomMetricNameTemplate()
{
if (self::$customMetricNameTemplate == null) {
self::$customMetricNameTemplate = new PathTemplate('properties/{property}/customMetrics');
self::$customMetricNameTemplate = new PathTemplate('properties/{property}/customMetrics/{custom_metric}');
}

return self::$customMetricNameTemplate;
Expand Down Expand Up @@ -514,15 +514,17 @@ public static function conversionEventName($property, $conversionEvent)
* custom_dimension resource.
*
* @param string $property
* @param string $customDimension
*
* @return string The formatted custom_dimension resource.
*
* @experimental
*/
public static function customDimensionName($property)
public static function customDimensionName($property, $customDimension)
{
return self::getCustomDimensionNameTemplate()->render([
'property' => $property,
'custom_dimension' => $customDimension,
]);
}

Expand All @@ -531,15 +533,17 @@ public static function customDimensionName($property)
* custom_metric resource.
*
* @param string $property
* @param string $customMetric
*
* @return string The formatted custom_metric resource.
*
* @experimental
*/
public static function customMetricName($property)
public static function customMetricName($property, $customMetric)
{
return self::getCustomMetricNameTemplate()->render([
'property' => $property,
'custom_metric' => $customMetric,
]);
}

Expand Down Expand Up @@ -791,8 +795,8 @@ public static function userLinkName($account, $userLink)
* - account: accounts/{account}
* - accountUserLink: accounts/{account}/userLinks/{user_link}
* - conversionEvent: properties/{property}/conversionEvents/{conversion_event}
* - customDimension: properties/{property}/customDimensions
* - customMetric: properties/{property}/customMetrics
* - customDimension: properties/{property}/customDimensions/{custom_dimension}
* - customMetric: properties/{property}/customMetrics/{custom_metric}
* - dataRetentionSettings: properties/{property}/dataRetentionSettings
* - dataSharingSettings: accounts/{account}/dataSharingSettings
* - dataStream: properties/{property}/dataStreams/{data_stream}
Expand Down Expand Up @@ -1016,7 +1020,7 @@ public function approveDisplayVideo360AdvertiserLinkProposal($name, array $optio
* ```
* $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
* try {
* $formattedName = $analyticsAdminServiceClient->customDimensionName('[PROPERTY]');
* $formattedName = $analyticsAdminServiceClient->customDimensionName('[PROPERTY]', '[CUSTOM_DIMENSION]');
* $analyticsAdminServiceClient->archiveCustomDimension($formattedName);
* } finally {
* $analyticsAdminServiceClient->close();
Expand Down Expand Up @@ -1057,7 +1061,7 @@ public function archiveCustomDimension($name, array $optionalArgs = [])
* ```
* $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
* try {
* $formattedName = $analyticsAdminServiceClient->customMetricName('[PROPERTY]');
* $formattedName = $analyticsAdminServiceClient->customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');
* $analyticsAdminServiceClient->archiveCustomMetric($formattedName);
* } finally {
* $analyticsAdminServiceClient->close();
Expand Down Expand Up @@ -2464,7 +2468,7 @@ public function getConversionEvent($name, array $optionalArgs = [])
* ```
* $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
* try {
* $formattedName = $analyticsAdminServiceClient->customDimensionName('[PROPERTY]');
* $formattedName = $analyticsAdminServiceClient->customDimensionName('[PROPERTY]', '[CUSTOM_DIMENSION]');
* $response = $analyticsAdminServiceClient->getCustomDimension($formattedName);
* } finally {
* $analyticsAdminServiceClient->close();
Expand Down Expand Up @@ -2507,7 +2511,7 @@ public function getCustomDimension($name, array $optionalArgs = [])
* ```
* $analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
* try {
* $formattedName = $analyticsAdminServiceClient->customMetricName('[PROPERTY]');
* $formattedName = $analyticsAdminServiceClient->customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');
* $response = $analyticsAdminServiceClient->getCustomMetric($formattedName);
* } finally {
* $analyticsAdminServiceClient->close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function archiveCustomDimensionTest()
$expectedResponse = new GPBEmpty();
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $client->customDimensionName('[PROPERTY]');
$formattedName = $client->customDimensionName('[PROPERTY]', '[CUSTOM_DIMENSION]');
$client->archiveCustomDimension($formattedName);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
Expand Down Expand Up @@ -287,7 +287,7 @@ public function archiveCustomDimensionExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
$formattedName = $client->customDimensionName('[PROPERTY]');
$formattedName = $client->customDimensionName('[PROPERTY]', '[CUSTOM_DIMENSION]');
try {
$client->archiveCustomDimension($formattedName);
// If the $client method call did not throw, fail the test
Expand Down Expand Up @@ -315,7 +315,7 @@ public function archiveCustomMetricTest()
$expectedResponse = new GPBEmpty();
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $client->customMetricName('[PROPERTY]');
$formattedName = $client->customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');
$client->archiveCustomMetric($formattedName);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
Expand Down Expand Up @@ -348,7 +348,7 @@ public function archiveCustomMetricExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
$formattedName = $client->customMetricName('[PROPERTY]');
$formattedName = $client->customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');
try {
$client->archiveCustomMetric($formattedName);
// If the $client method call did not throw, fail the test
Expand Down Expand Up @@ -2402,7 +2402,7 @@ public function getCustomDimensionTest()
$expectedResponse->setDisallowAdsPersonalization($disallowAdsPersonalization);
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $client->customDimensionName('[PROPERTY]');
$formattedName = $client->customDimensionName('[PROPERTY]', '[CUSTOM_DIMENSION]');
$response = $client->getCustomDimension($formattedName);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
Expand Down Expand Up @@ -2436,7 +2436,7 @@ public function getCustomDimensionExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
$formattedName = $client->customDimensionName('[PROPERTY]');
$formattedName = $client->customDimensionName('[PROPERTY]', '[CUSTOM_DIMENSION]');
try {
$client->getCustomDimension($formattedName);
// If the $client method call did not throw, fail the test
Expand Down Expand Up @@ -2472,7 +2472,7 @@ public function getCustomMetricTest()
$expectedResponse->setDescription($description);
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $client->customMetricName('[PROPERTY]');
$formattedName = $client->customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');
$response = $client->getCustomMetric($formattedName);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
Expand Down Expand Up @@ -2506,7 +2506,7 @@ public function getCustomMetricExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
$formattedName = $client->customMetricName('[PROPERTY]');
$formattedName = $client->customMetricName('[PROPERTY]', '[CUSTOM_METRIC]');
try {
$client->getCustomMetric($formattedName);
// If the $client method call did not throw, fail the test
Expand Down

0 comments on commit b106d7e

Please sign in to comment.