Skip to content

Commit

Permalink
feat: add GetPropertyQuotasSnapshot method to the Data API v1alpha (#…
Browse files Browse the repository at this point in the history
…7684)

feat: add `PropertyQuotasSnapshot` type to the Data API v1alpha
docs: update the documentation for the `CreateReportTask` method
PiperOrigin-RevId: 676527881
Source-Link: googleapis/googleapis@923b6f3
Source-Link: googleapis/googleapis-gen@8729c5b
Copy-Tag: eyJwIjoiQW5hbHl0aWNzRGF0YS8uT3dsQm90LnlhbWwiLCJoIjoiODcyOWM1YjRjZGFjY2E5NjczY2VhYjQzZjkwYmZmZGM5N2FhNTE0NyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Sep 23, 2024
1 parent d1f547f commit c337a90
Show file tree
Hide file tree
Showing 18 changed files with 700 additions and 26 deletions.
Binary file modified AnalyticsData/metadata/V1Alpha/AnalyticsDataApi.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
* asynchronous request to form a customized report of your Google Analytics
* event data.
*
* A report task will be retained and available for querying for 72 hours
* after it has been created.
*
* A report task created by one user can be listed and queried by all users
* who have access to the property.
*
* @param string $formattedParent The parent resource where this report task will be created.
* Format: `properties/{propertyId}`
* Please see {@see AlphaAnalyticsDataClient::propertyName()} for help formatting this field.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetPropertyQuotasSnapshot_sync]
use Google\Analytics\Data\V1alpha\Client\AlphaAnalyticsDataClient;
use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest;
use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot;
use Google\ApiCore\ApiException;

/**
* Get all property quotas organized by quota category for a given property.
* This will charge 1 property quota from the category with the most quota.
*
* @param string $formattedName Quotas from this property will be listed in the response.
* Format: `properties/{property}/propertyQuotasSnapshot`
* Please see {@see AlphaAnalyticsDataClient::propertyQuotasSnapshotName()} for help formatting this field.
*/
function get_property_quotas_snapshot_sample(string $formattedName): void
{
// Create a client.
$alphaAnalyticsDataClient = new AlphaAnalyticsDataClient();

// Prepare the request message.
$request = (new GetPropertyQuotasSnapshotRequest())
->setName($formattedName);

// Call the API and handle any network failures.
try {
/** @var PropertyQuotasSnapshot $response */
$response = $alphaAnalyticsDataClient->getPropertyQuotasSnapshot($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 = AlphaAnalyticsDataClient::propertyQuotasSnapshotName('[PROPERTY]');

get_property_quotas_snapshot_sample($formattedName);
}
// [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetPropertyQuotasSnapshot_sync]
57 changes: 57 additions & 0 deletions AnalyticsData/src/V1alpha/Client/AlphaAnalyticsDataClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
use Google\Analytics\Data\V1alpha\CreateRecurringAudienceListRequest;
use Google\Analytics\Data\V1alpha\CreateReportTaskRequest;
use Google\Analytics\Data\V1alpha\GetAudienceListRequest;
use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest;
use Google\Analytics\Data\V1alpha\GetRecurringAudienceListRequest;
use Google\Analytics\Data\V1alpha\GetReportTaskRequest;
use Google\Analytics\Data\V1alpha\ListAudienceListsRequest;
use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsRequest;
use Google\Analytics\Data\V1alpha\ListReportTasksRequest;
use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot;
use Google\Analytics\Data\V1alpha\QueryAudienceListRequest;
use Google\Analytics\Data\V1alpha\QueryAudienceListResponse;
use Google\Analytics\Data\V1alpha\QueryReportTaskRequest;
Expand Down Expand Up @@ -78,6 +80,7 @@
* @method PromiseInterface createRecurringAudienceListAsync(CreateRecurringAudienceListRequest $request, array $optionalArgs = [])
* @method PromiseInterface createReportTaskAsync(CreateReportTaskRequest $request, array $optionalArgs = [])
* @method PromiseInterface getAudienceListAsync(GetAudienceListRequest $request, array $optionalArgs = [])
* @method PromiseInterface getPropertyQuotasSnapshotAsync(GetPropertyQuotasSnapshotRequest $request, array $optionalArgs = [])
* @method PromiseInterface getRecurringAudienceListAsync(GetRecurringAudienceListRequest $request, array $optionalArgs = [])
* @method PromiseInterface getReportTaskAsync(GetReportTaskRequest $request, array $optionalArgs = [])
* @method PromiseInterface listAudienceListsAsync(ListAudienceListsRequest $request, array $optionalArgs = [])
Expand Down Expand Up @@ -211,6 +214,23 @@ public static function propertyName(string $property): string
]);
}

/**
* Formats a string containing the fully-qualified path to represent a
* property_quotas_snapshot resource.
*
* @param string $property
*
* @return string The formatted property_quotas_snapshot resource.
*
* @experimental
*/
public static function propertyQuotasSnapshotName(string $property): string
{
return self::getPathTemplate('propertyQuotasSnapshot')->render([
'property' => $property,
]);
}

/**
* Formats a string containing the fully-qualified path to represent a
* recurring_audience_list resource.
Expand Down Expand Up @@ -255,6 +275,7 @@ public static function reportTaskName(string $property, string $reportTask): str
* Template: Pattern
* - audienceList: properties/{property}/audienceLists/{audience_list}
* - property: properties/{property}
* - propertyQuotasSnapshot: properties/{property}/propertyQuotasSnapshot
* - recurringAudienceList: properties/{property}/recurringAudienceLists/{recurring_audience_list}
* - reportTask: properties/{property}/reportTasks/{report_task}
*
Expand Down Expand Up @@ -456,6 +477,12 @@ public function createRecurringAudienceList(CreateRecurringAudienceListRequest $
* asynchronous request to form a customized report of your Google Analytics
* event data.
*
* A report task will be retained and available for querying for 72 hours
* after it has been created.
*
* A report task created by one user can be listed and queried by all users
* who have access to the property.
*
* The async variant is {@see AlphaAnalyticsDataClient::createReportTaskAsync()} .
*
* @example samples/V1alpha/AlphaAnalyticsDataClient/create_report_task.php
Expand Down Expand Up @@ -520,6 +547,36 @@ public function getAudienceList(GetAudienceListRequest $request, array $callOpti
return $this->startApiCall('GetAudienceList', $request, $callOptions)->wait();
}

/**
* Get all property quotas organized by quota category for a given property.
* This will charge 1 property quota from the category with the most quota.
*
* The async variant is
* {@see AlphaAnalyticsDataClient::getPropertyQuotasSnapshotAsync()} .
*
* @example samples/V1alpha/AlphaAnalyticsDataClient/get_property_quotas_snapshot.php
*
* @param GetPropertyQuotasSnapshotRequest $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 PropertyQuotasSnapshot
*
* @throws ApiException Thrown if the API call fails.
*
* @experimental
*/
public function getPropertyQuotasSnapshot(GetPropertyQuotasSnapshotRequest $request, array $callOptions = []): PropertyQuotasSnapshot
{
return $this->startApiCall('GetPropertyQuotasSnapshot', $request, $callOptions)->wait();
}

/**
* Gets configuration metadata about a specific recurring audience list. This
* method can be used to understand a recurring audience list's state after it
Expand Down
98 changes: 95 additions & 3 deletions AnalyticsData/src/V1alpha/Gapic/AlphaAnalyticsDataGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Google\Analytics\Data\V1alpha\FunnelBreakdown;
use Google\Analytics\Data\V1alpha\FunnelNextAction;
use Google\Analytics\Data\V1alpha\GetAudienceListRequest;
use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest;
use Google\Analytics\Data\V1alpha\GetRecurringAudienceListRequest;
use Google\Analytics\Data\V1alpha\GetReportTaskRequest;
use Google\Analytics\Data\V1alpha\ListAudienceListsRequest;
Expand All @@ -44,6 +45,7 @@
use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsResponse;
use Google\Analytics\Data\V1alpha\ListReportTasksRequest;
use Google\Analytics\Data\V1alpha\ListReportTasksResponse;
use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot;
use Google\Analytics\Data\V1alpha\QueryAudienceListRequest;
use Google\Analytics\Data\V1alpha\QueryAudienceListResponse;
use Google\Analytics\Data\V1alpha\QueryReportTaskRequest;
Expand Down Expand Up @@ -155,6 +157,8 @@ class AlphaAnalyticsDataGapicClient

private static $propertyNameTemplate;

private static $propertyQuotasSnapshotNameTemplate;

private static $recurringAudienceListNameTemplate;

private static $reportTaskNameTemplate;
Expand Down Expand Up @@ -212,6 +216,17 @@ private static function getPropertyNameTemplate()
return self::$propertyNameTemplate;
}

private static function getPropertyQuotasSnapshotNameTemplate()
{
if (self::$propertyQuotasSnapshotNameTemplate == null) {
self::$propertyQuotasSnapshotNameTemplate = new PathTemplate(
'properties/{property}/propertyQuotasSnapshot'
);
}

return self::$propertyQuotasSnapshotNameTemplate;
}

private static function getRecurringAudienceListNameTemplate()
{
if (self::$recurringAudienceListNameTemplate == null) {
Expand Down Expand Up @@ -240,6 +255,7 @@ private static function getPathTemplateMap()
self::$pathTemplateMap = [
'audienceList' => self::getAudienceListNameTemplate(),
'property' => self::getPropertyNameTemplate(),
'propertyQuotasSnapshot' => self::getPropertyQuotasSnapshotNameTemplate(),
'recurringAudienceList' => self::getRecurringAudienceListNameTemplate(),
'reportTask' => self::getReportTaskNameTemplate(),
];
Expand Down Expand Up @@ -284,6 +300,23 @@ public static function propertyName($property)
]);
}

/**
* Formats a string containing the fully-qualified path to represent a
* property_quotas_snapshot resource.
*
* @param string $property
*
* @return string The formatted property_quotas_snapshot resource.
*
* @experimental
*/
public static function propertyQuotasSnapshotName($property)
{
return self::getPropertyQuotasSnapshotNameTemplate()->render([
'property' => $property,
]);
}

/**
* Formats a string containing the fully-qualified path to represent a
* recurring_audience_list resource.
Expand Down Expand Up @@ -330,6 +363,7 @@ public static function reportTaskName($property, $reportTask)
* Template: Pattern
* - audienceList: properties/{property}/audienceLists/{audience_list}
* - property: properties/{property}
* - propertyQuotasSnapshot: properties/{property}/propertyQuotasSnapshot
* - recurringAudienceList: properties/{property}/recurringAudienceLists/{recurring_audience_list}
* - reportTask: properties/{property}/reportTasks/{report_task}
*
Expand Down Expand Up @@ -661,6 +695,12 @@ public function createRecurringAudienceList(
* asynchronous request to form a customized report of your Google Analytics
* event data.
*
* A report task will be retained and available for querying for 72 hours
* after it has been created.
*
* A report task created by one user can be listed and queried by all users
* who have access to the property.
*
* Sample code:
* ```
* $alphaAnalyticsDataClient = new AlphaAnalyticsDataClient();
Expand Down Expand Up @@ -802,6 +842,58 @@ public function getAudienceList($name, array $optionalArgs = [])
)->wait();
}

/**
* Get all property quotas organized by quota category for a given property.
* This will charge 1 property quota from the category with the most quota.
*
* Sample code:
* ```
* $alphaAnalyticsDataClient = new AlphaAnalyticsDataClient();
* try {
* $formattedName = $alphaAnalyticsDataClient->propertyQuotasSnapshotName('[PROPERTY]');
* $response = $alphaAnalyticsDataClient->getPropertyQuotasSnapshot($formattedName);
* } finally {
* $alphaAnalyticsDataClient->close();
* }
* ```
*
* @param string $name Required. Quotas from this property will be listed in the response.
* Format: `properties/{property}/propertyQuotasSnapshot`
* @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\Data\V1alpha\PropertyQuotasSnapshot
*
* @throws ApiException if the remote call fails
*
* @experimental
*/
public function getPropertyQuotasSnapshot($name, array $optionalArgs = [])
{
$request = new GetPropertyQuotasSnapshotRequest();
$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(
'GetPropertyQuotasSnapshot',
PropertyQuotasSnapshot::class,
$optionalArgs,
$request
)->wait();
}

/**
* Gets configuration metadata about a specific recurring audience list. This
* method can be used to understand a recurring audience list's state after it
Expand Down Expand Up @@ -1401,9 +1493,9 @@ public function queryReportTask($name, array $optionalArgs = [])
* Optional.
*
* @type string $property
* Optional. A Google Analytics GA4 property identifier whose events are
* tracked. Specified in the URL path and not the body. To learn more, see
* [where to find your Property
* Optional. A Google Analytics property identifier whose events are tracked.
* Specified in the URL path and not the body. To learn more, see [where to
* find your Property
* ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
* Within a batch request, this property should either be unspecified or
* consistent with the batch-level property.
Expand Down
Loading

0 comments on commit c337a90

Please sign in to comment.