Skip to content

Commit 17b5d48

Browse files
feat: [AnalyticsAdmin] add the CreateReportingDataAnnotation method (#8236)
* feat: add the `CreateReportingDataAnnotation` method feat: add the `GetReportingDataAnnotation` method feat: add the `ListReportingDataAnnotations` method feat: add the `UpdateReportingDataAnnotation` method feat: add the `DeleteReportingDataAnnotation` method feat: add the `SubmitUserDeletion` method feat: add the `REPORTING_DATA_ANNOTATION` resource type to the `ChangeHistoryResourceType` enum fix!: change an existing value KEY_EVENT = 32 to KEY_EVENT = 30 in enum `ChangeHistoryResourceType`. fix!: rename an existing field `key_event` to `reporting_data_annotation` in `ChangeHistoryChange`. feat: add the `ReportingDataAnnotation` type feat: add `key_event`, `reporting_data_annotation` fields to the `ChangeHistoryResource` resource docs: announce the deprecation of the `sharing_with_google_any_sales_enabled` field of the `DataSharingSettings` type docs: update the documentation of `sharing_with_google_support_enabled`, `sharing_with_google_assigned_sales_enabled`, 'sharing_with_google_products_enabled', 'sharing_with_others_enabled' fields of the `DataSharingSettings` type PiperOrigin-RevId: 748054282 Source-Link: googleapis/googleapis@1137462 Source-Link: googleapis/googleapis-gen@383795c Copy-Tag: eyJwIjoiQW5hbHl0aWNzQWRtaW4vLk93bEJvdC55YW1sIiwiaCI6IjM4Mzc5NWM0MjZlNzRmZTRmMTdlMzQ1ZTJmYjZhZTdmYjM3MjFkZjAifQ== * 🦉 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>
1 parent 1e61c11 commit 17b5d48

28 files changed

Lines changed: 3384 additions & 54 deletions

AnalyticsAdmin/metadata/V1Alpha/AnalyticsAdmin.php

Lines changed: 40 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
966 Bytes
Binary file not shown.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateReportingDataAnnotation_sync]
26+
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
27+
use Google\Analytics\Admin\V1alpha\CreateReportingDataAnnotationRequest;
28+
use Google\Analytics\Admin\V1alpha\ReportingDataAnnotation;
29+
use Google\Analytics\Admin\V1alpha\ReportingDataAnnotation\Color;
30+
use Google\ApiCore\ApiException;
31+
32+
/**
33+
* Creates a Reporting Data Annotation.
34+
*
35+
* @param string $formattedParent The property for which to create a Reporting Data Annotation.
36+
* Format: properties/property_id
37+
* Example: properties/123
38+
* Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
39+
* @param string $reportingDataAnnotationName Identifier. Resource name of this Reporting Data Annotation.
40+
* Format:
41+
* 'properties/{property_id}/reportingDataAnnotations/{reporting_data_annotation}'
42+
* Format: 'properties/123/reportingDataAnnotations/456'
43+
* @param string $reportingDataAnnotationTitle Human-readable title for this Reporting Data Annotation.
44+
* @param int $reportingDataAnnotationColor The color used for display of this Reporting Data Annotation.
45+
*/
46+
function create_reporting_data_annotation_sample(
47+
string $formattedParent,
48+
string $reportingDataAnnotationName,
49+
string $reportingDataAnnotationTitle,
50+
int $reportingDataAnnotationColor
51+
): void {
52+
// Create a client.
53+
$analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
54+
55+
// Prepare the request message.
56+
$reportingDataAnnotation = (new ReportingDataAnnotation())
57+
->setName($reportingDataAnnotationName)
58+
->setTitle($reportingDataAnnotationTitle)
59+
->setColor($reportingDataAnnotationColor);
60+
$request = (new CreateReportingDataAnnotationRequest())
61+
->setParent($formattedParent)
62+
->setReportingDataAnnotation($reportingDataAnnotation);
63+
64+
// Call the API and handle any network failures.
65+
try {
66+
/** @var ReportingDataAnnotation $response */
67+
$response = $analyticsAdminServiceClient->createReportingDataAnnotation($request);
68+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
69+
} catch (ApiException $ex) {
70+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
71+
}
72+
}
73+
74+
/**
75+
* Helper to execute the sample.
76+
*
77+
* This sample has been automatically generated and should be regarded as a code
78+
* template only. It will require modifications to work:
79+
* - It may require correct/in-range values for request initialization.
80+
* - It may require specifying regional endpoints when creating the service client,
81+
* please see the apiEndpoint client configuration option for more details.
82+
*/
83+
function callSample(): void
84+
{
85+
$formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
86+
$reportingDataAnnotationName = '[NAME]';
87+
$reportingDataAnnotationTitle = '[TITLE]';
88+
$reportingDataAnnotationColor = Color::COLOR_UNSPECIFIED;
89+
90+
create_reporting_data_annotation_sample(
91+
$formattedParent,
92+
$reportingDataAnnotationName,
93+
$reportingDataAnnotationTitle,
94+
$reportingDataAnnotationColor
95+
);
96+
}
97+
// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateReportingDataAnnotation_sync]
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteReportingDataAnnotation_sync]
26+
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
27+
use Google\Analytics\Admin\V1alpha\DeleteReportingDataAnnotationRequest;
28+
use Google\ApiCore\ApiException;
29+
30+
/**
31+
* Deletes a Reporting Data Annotation.
32+
*
33+
* @param string $formattedName Resource name of the Reporting Data Annotation to delete.
34+
* Format:
35+
* properties/property_id/reportingDataAnnotations/reporting_data_annotation
36+
* Example: properties/123/reportingDataAnnotations/456
37+
* Please see {@see AnalyticsAdminServiceClient::reportingDataAnnotationName()} for help formatting this field.
38+
*/
39+
function delete_reporting_data_annotation_sample(string $formattedName): void
40+
{
41+
// Create a client.
42+
$analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
43+
44+
// Prepare the request message.
45+
$request = (new DeleteReportingDataAnnotationRequest())
46+
->setName($formattedName);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
$analyticsAdminServiceClient->deleteReportingDataAnnotation($request);
51+
printf('Call completed successfully.' . PHP_EOL);
52+
} catch (ApiException $ex) {
53+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
54+
}
55+
}
56+
57+
/**
58+
* Helper to execute the sample.
59+
*
60+
* This sample has been automatically generated and should be regarded as a code
61+
* template only. It will require modifications to work:
62+
* - It may require correct/in-range values for request initialization.
63+
* - It may require specifying regional endpoints when creating the service client,
64+
* please see the apiEndpoint client configuration option for more details.
65+
*/
66+
function callSample(): void
67+
{
68+
$formattedName = AnalyticsAdminServiceClient::reportingDataAnnotationName(
69+
'[PROPERTY]',
70+
'[REPORTING_DATA_ANNOTATION]'
71+
);
72+
73+
delete_reporting_data_annotation_sample($formattedName);
74+
}
75+
// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteReportingDataAnnotation_sync]
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetReportingDataAnnotation_sync]
26+
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
27+
use Google\Analytics\Admin\V1alpha\GetReportingDataAnnotationRequest;
28+
use Google\Analytics\Admin\V1alpha\ReportingDataAnnotation;
29+
use Google\ApiCore\ApiException;
30+
31+
/**
32+
* Lookup a single Reporting Data Annotation.
33+
*
34+
* @param string $formattedName Resource name of the Reporting Data Annotation to lookup.
35+
* Format:
36+
* properties/property_id/reportingDataAnnotations/reportingDataAnnotation
37+
* Example: properties/123/reportingDataAnnotations/456
38+
* Please see {@see AnalyticsAdminServiceClient::reportingDataAnnotationName()} for help formatting this field.
39+
*/
40+
function get_reporting_data_annotation_sample(string $formattedName): void
41+
{
42+
// Create a client.
43+
$analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
44+
45+
// Prepare the request message.
46+
$request = (new GetReportingDataAnnotationRequest())
47+
->setName($formattedName);
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var ReportingDataAnnotation $response */
52+
$response = $analyticsAdminServiceClient->getReportingDataAnnotation($request);
53+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
54+
} catch (ApiException $ex) {
55+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
56+
}
57+
}
58+
59+
/**
60+
* Helper to execute the sample.
61+
*
62+
* This sample has been automatically generated and should be regarded as a code
63+
* template only. It will require modifications to work:
64+
* - It may require correct/in-range values for request initialization.
65+
* - It may require specifying regional endpoints when creating the service client,
66+
* please see the apiEndpoint client configuration option for more details.
67+
*/
68+
function callSample(): void
69+
{
70+
$formattedName = AnalyticsAdminServiceClient::reportingDataAnnotationName(
71+
'[PROPERTY]',
72+
'[REPORTING_DATA_ANNOTATION]'
73+
);
74+
75+
get_reporting_data_annotation_sample($formattedName);
76+
}
77+
// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetReportingDataAnnotation_sync]
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListReportingDataAnnotations_sync]
26+
use Google\Analytics\Admin\V1alpha\Client\AnalyticsAdminServiceClient;
27+
use Google\Analytics\Admin\V1alpha\ListReportingDataAnnotationsRequest;
28+
use Google\Analytics\Admin\V1alpha\ReportingDataAnnotation;
29+
use Google\ApiCore\ApiException;
30+
use Google\ApiCore\PagedListResponse;
31+
32+
/**
33+
* List all Reporting Data Annotations on a property.
34+
*
35+
* @param string $formattedParent Resource name of the property.
36+
* Format: properties/property_id
37+
* Example: properties/123
38+
* Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
39+
*/
40+
function list_reporting_data_annotations_sample(string $formattedParent): void
41+
{
42+
// Create a client.
43+
$analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
44+
45+
// Prepare the request message.
46+
$request = (new ListReportingDataAnnotationsRequest())
47+
->setParent($formattedParent);
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var PagedListResponse $response */
52+
$response = $analyticsAdminServiceClient->listReportingDataAnnotations($request);
53+
54+
/** @var ReportingDataAnnotation $element */
55+
foreach ($response as $element) {
56+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
57+
}
58+
} catch (ApiException $ex) {
59+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
60+
}
61+
}
62+
63+
/**
64+
* Helper to execute the sample.
65+
*
66+
* This sample has been automatically generated and should be regarded as a code
67+
* template only. It will require modifications to work:
68+
* - It may require correct/in-range values for request initialization.
69+
* - It may require specifying regional endpoints when creating the service client,
70+
* please see the apiEndpoint client configuration option for more details.
71+
*/
72+
function callSample(): void
73+
{
74+
$formattedParent = AnalyticsAdminServiceClient::propertyName('[PROPERTY]');
75+
76+
list_reporting_data_annotations_sample($formattedParent);
77+
}
78+
// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListReportingDataAnnotations_sync]

0 commit comments

Comments
 (0)