Skip to content

Commit 1566d8d

Browse files
authored
Merge branch 'GoogleCloudPlatform:main' into main
2 parents 621c1e6 + ac4062a commit 1566d8d

File tree

151 files changed

+3425
-729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+3425
-729
lines changed

.kokoro/secrets.sh.enc

68 Bytes
Binary file not shown.

CODEOWNERS

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,47 @@
1-
# Code owners file.
2-
# This file controls who is tagged for review for any given pull request.
1+
# Code owners file
2+
3+
# This file controls who is tagged for review for any given pull request
4+
35
#
4-
# For syntax help see:
5-
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
66

7+
# For syntax help see
8+
9+
# <https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax>
710

811
# The php-admins team is the default owner for anything not
9-
# explicitly taken by someone else.
10-
* @GoogleCloudPlatform/php-samples-reviewers
12+
13+
# explicitly taken by someone else
14+
15+
* @GoogleCloudPlatform/php-samples-reviewers
1116

1217
# Kokoro
18+
1319
.kokoro @GoogleCloudPlatform/php-admins
1420

1521
/bigtable/**/*.php @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/php-samples-reviewers
1622
/cloud_sql/**/*.php @GoogleCloudPlatform/infra-db-dpes @GoogleCloudPlatform/php-samples-reviewers
1723
/datastore/**/*.php @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/php-samples-reviewers
1824
/firestore/**/*.php @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/php-samples-reviewers
19-
/iot/ @GoogleCloudPlatform/api-iot @GoogleCloudPlatform/php-samples-reviewers
2025
/storage/ @GoogleCloudPlatform/cloud-storage-dpe @GoogleCloudPlatform/php-samples-reviewers
2126
/spanner/ @GoogleCloudPlatform/api-spanner @GoogleCloudPlatform/php-samples-reviewers
2227

2328
# Serverless, Orchestration, DevOps
29+
2430
/appengine/ @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/php-samples-reviewers
25-
/functions/ @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/php-samples-reviewers
31+
/functions/ @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/php-samples-reviewers
2632
/run/ @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/php-samples-reviewers
2733
/eventarc/ @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/php-samples-reviewers
2834

2935
# Functions samples owned by the Firebase team
30-
/functions/firebase_analytics @schandel
36+
37+
/functions/firebase_analytics @schandel
3138

3239
# DLP samples owned by DLP team
40+
3341
/dlp/ @GoogleCloudPlatform/googleapis-dlp
3442

3543
# Brent is taking ownership of these samples as they are not supported by the ML team
44+
3645
/dialogflow/ @bshaffer
3746
/language/ @bshaffer
3847
/speech/ @bshaffer
@@ -42,4 +51,9 @@
4251
/video/ @bshaffer
4352

4453
# Compute samples owned by Remik
54+
4555
/compute/cloud-client/ @rsamborski
56+
57+
# Deprecated
58+
59+
/iot/ @GoogleCloudPlatform/php-samples-reviewers

analyticsdata/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"google/analytics-data": "^0.9.0"
3+
"google/analytics-data": "^0.11.0"
44
}
55
}

analyticsdata/quickstart.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
// [START analytics_data_quickstart]
3232
require 'vendor/autoload.php';
3333

34-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
34+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
3535
use Google\Analytics\Data\V1beta\DateRange;
3636
use Google\Analytics\Data\V1beta\Dimension;
3737
use Google\Analytics\Data\V1beta\Metric;
38+
use Google\Analytics\Data\V1beta\RunReportRequest;
3839

3940
/**
4041
* TODO(developer): Replace this variable with your Google Analytics 4
@@ -50,27 +51,23 @@
5051

5152
// [START analyticsdata_run_report]
5253
// Make an API call.
53-
$response = $client->runReport([
54-
'property' => 'properties/' . $property_id,
55-
'dateRanges' => [
54+
$request = (new RunReportRequest())
55+
->setProperty('properties/' . $property_id)
56+
->setDateRanges([
5657
new DateRange([
5758
'start_date' => '2020-03-31',
5859
'end_date' => 'today',
5960
]),
60-
],
61-
'dimensions' => [new Dimension(
62-
[
61+
])
62+
->setDimensions([new Dimension([
6363
'name' => 'city',
64-
]
65-
),
66-
],
67-
'metrics' => [new Metric(
68-
[
64+
]),
65+
])
66+
->setMetrics([new Metric([
6967
'name' => 'activeUsers',
70-
]
71-
)
72-
]
73-
]);
68+
])
69+
]);
70+
$response = $client->runReport($request);
7471
// [END analyticsdata_run_report]
7572

7673
// [START analyticsdata_run_report_response]

analyticsdata/quickstart_oauth2/index.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
// [START analyticsdata_quickstart_oauth2]
1919
require 'vendor/autoload.php';
2020

21-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
21+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
2222
use Google\Analytics\Data\V1beta\DateRange;
2323
use Google\Analytics\Data\V1beta\Dimension;
2424
use Google\Analytics\Data\V1beta\Metric;
25+
use Google\Analytics\Data\V1beta\RunReportRequest;
2526
use Google\ApiCore\ApiException;
2627
use Google\Auth\OAuth2;
2728

@@ -56,27 +57,23 @@
5657
try {
5758
// Make an API call.
5859
$client = new BetaAnalyticsDataClient(['credentials' => $oauth]);
59-
$response = $client->runReport([
60-
'property' => 'properties/' . $property_id,
61-
'dateRanges' => [
60+
$request = (new RunReportRequest())
61+
->setProperty('properties/' . $property_id)
62+
->setDateRanges([
6263
new DateRange([
6364
'start_date' => '2020-03-31',
6465
'end_date' => 'today',
6566
]),
66-
],
67-
'dimensions' => [new Dimension(
68-
[
67+
])
68+
->setDimensions([new Dimension([
6969
'name' => 'city',
70-
]
71-
),
72-
],
73-
'metrics' => [new Metric(
74-
[
70+
]),
71+
])
72+
->setMetrics([new Metric([
7573
'name' => 'activeUsers',
76-
]
77-
)
78-
]
79-
]);
74+
])
75+
]);
76+
$response = $client->runReport($request);
8077

8178
// Print results of an API call.
8279
print 'Report result: <br />';

analyticsdata/src/client_from_json_credentials.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* $analyticsDataClient = require 'src/client_from_json_credentials.php';
2727
* ```
2828
*/
29-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
29+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
3030

3131
// [START analyticsdata_json_credentials_initialize]
3232
/**

analyticsdata/src/get_common_metadata.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
namespace Google\Cloud\Samples\Analytics\Data;
2929

3030
// [START analyticsdata_get_common_metadata]
31-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
31+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
32+
use Google\Analytics\Data\V1beta\GetMetadataRequest;
3233
use Google\Analytics\Data\V1beta\Metadata;
3334
use Google\ApiCore\ApiException;
3435

@@ -50,7 +51,9 @@ function get_common_metadata()
5051

5152
// Make an API call.
5253
try {
53-
$response = $client->getMetadata($formattedName);
54+
$request = (new GetMetadataRequest())
55+
->setName($formattedName);
56+
$response = $client->getMetadata($request);
5457
} catch (ApiException $ex) {
5558
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
5659
}

analyticsdata/src/get_metadata_by_property_id.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
namespace Google\Cloud\Samples\Analytics\Data;
2929

3030
// [START analyticsdata_get_metadata_by_property_id]
31-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
31+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
32+
use Google\Analytics\Data\V1beta\GetMetadataRequest;
3233
use Google\Analytics\Data\V1beta\Metadata;
3334
use Google\ApiCore\ApiException;
3435

@@ -46,7 +47,9 @@ function get_metadata_by_property_id(string $propertyId)
4647

4748
// Make an API call.
4849
try {
49-
$response = $client->getMetadata($formattedName);
50+
$request = (new GetMetadataRequest())
51+
->setName($formattedName);
52+
$response = $client->getMetadata($request);
5053
} catch (ApiException $ex) {
5154
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
5255
}

analyticsdata/src/run_batch_report.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
namespace Google\Cloud\Samples\Analytics\Data;
2929

3030
// [START analyticsdata_run_batch_report]
31-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
31+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
32+
use Google\Analytics\Data\V1beta\BatchRunReportsRequest;
3233
use Google\Analytics\Data\V1beta\DateRange;
3334
use Google\Analytics\Data\V1beta\Dimension;
3435
use Google\Analytics\Data\V1beta\Metric;
@@ -46,9 +47,9 @@ function run_batch_report(string $propertyId)
4647
$client = new BetaAnalyticsDataClient();
4748

4849
// Make an API call.
49-
$response = $client->batchRunReports([
50-
'property' => 'properties/' . $propertyId,
51-
'requests' => [
50+
$request = (new BatchRunReportsRequest())
51+
->setProperty('properties/' . $propertyId)
52+
->setRequests([
5253
new RunReportRequest([
5354
'dimensions' => [
5455
new Dimension(['name' => 'country']),
@@ -71,8 +72,8 @@ function run_batch_report(string $propertyId)
7172
]),
7273
],
7374
]),
74-
],
75-
]);
75+
]);
76+
$response = $client->batchRunReports($request);
7677

7778
print 'Batch report results' . PHP_EOL;
7879
foreach ($response->getReports() as $report) {

analyticsdata/src/run_pivot_report.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
namespace Google\Cloud\Samples\Analytics\Data;
2929

3030
// [START analyticsdata_run_pivot_report]
31-
use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
31+
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
3232
use Google\Analytics\Data\V1beta\DateRange;
3333
use Google\Analytics\Data\V1beta\Dimension;
3434
use Google\Analytics\Data\V1beta\Metric;
35-
use Google\Analytics\Data\V1beta\Pivot;
3635
use Google\Analytics\Data\V1beta\OrderBy;
3736
use Google\Analytics\Data\V1beta\OrderBy\DimensionOrderBy;
3837
use Google\Analytics\Data\V1beta\OrderBy\MetricOrderBy;
38+
use Google\Analytics\Data\V1beta\Pivot;
39+
use Google\Analytics\Data\V1beta\RunPivotReportRequest;
3940
use Google\Analytics\Data\V1beta\RunPivotReportResponse;
4041

4142
/**
@@ -49,14 +50,14 @@ function run_pivot_report(string $propertyId)
4950
$client = new BetaAnalyticsDataClient();
5051

5152
// Make an API call.
52-
$response = $client->runPivotReport([
53-
'property' => 'properties/' . $propertyId,
54-
'dateRanges' => [new DateRange([
53+
$request = (new RunPivotReportRequest())
54+
->setProperty('properties/' . $propertyId)
55+
->setDateRanges([new DateRange([
5556
'start_date' => '2021-01-01',
5657
'end_date' => '2021-01-30',
5758
]),
58-
],
59-
'pivots' => [
59+
])
60+
->setPivots([
6061
new Pivot([
6162
'field_names' => ['country'],
6263
'limit' => 250,
@@ -77,13 +78,13 @@ function run_pivot_report(string $propertyId)
7778
'desc' => true,
7879
])],
7980
]),
80-
],
81-
'metrics' => [new Metric(['name' => 'sessions'])],
82-
'dimensions' => [
81+
])
82+
->setMetrics([new Metric(['name' => 'sessions'])])
83+
->setDimensions([
8384
new Dimension(['name' => 'country']),
8485
new Dimension(['name' => 'browser']),
85-
],
86-
]);
86+
]);
87+
$response = $client->runPivotReport($request);
8788

8889
printPivotReportResponse($response);
8990
}

0 commit comments

Comments
 (0)