Skip to content

Commit 92316e2

Browse files
feat: [AdsMarketingPlatformAdmin] add the ListOrganizations, FindSalesPartnerManagedClients, and ReportPropertyUsage methods (#8708)
* feat: add the `ListOrganizations`, `FindSalesPartnerManagedClients`, and `ReportPropertyUsage` methods feat: define AnalyticsServiceLevel and AnalyticsPropertyType enums in resources.proto feat: update OAuth scopes in marketingplatformadmin_v1alpha.yaml feat: add the `ListOrganizationsRequest` and `ListOrganizationsResponse` resources feat: add the `FindSalesPartnerManagedClientsRequest` and `FindSalesPartnerManagedClientsResponse` resources feat: add the `ReportPropertyUsageRequest` and `ReportPropertyUsageResponse` resources PiperOrigin-RevId: 826146529 Source-Link: googleapis/googleapis@6a3acb3 Source-Link: googleapis/googleapis-gen@f4a107c Copy-Tag: eyJwIjoiQWRzTWFya2V0aW5nUGxhdGZvcm1BZG1pbi8uT3dsQm90LnlhbWwiLCJoIjoiZjRhMTA3Yzk1OTEzYjY3NzhiZjQyOTY2OGM3YzYzMGQ4NGFjYTA5NSJ9 * 🦉 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> Co-authored-by: Charlotte Y <38296042+cy-yun@users.noreply.github.com>
1 parent 70db3a1 commit 92316e2

22 files changed

Lines changed: 2046 additions & 10 deletions
Binary file not shown.
323 Bytes
Binary file not shown.
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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_FindSalesPartnerManagedClients_sync]
26+
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
27+
use Google\Ads\MarketingPlatform\Admin\V1alpha\FindSalesPartnerManagedClientsRequest;
28+
use Google\Ads\MarketingPlatform\Admin\V1alpha\FindSalesPartnerManagedClientsResponse;
29+
use Google\ApiCore\ApiException;
30+
31+
/**
32+
* Returns a list of clients managed by the sales partner organization.
33+
*
34+
* User needs to be an OrgAdmin/BillingAdmin on the sales partner organization
35+
* in order to view the end clients.
36+
*
37+
* @param string $formattedOrganization The name of the sales partner organization.
38+
* Format: organizations/{org_id}
39+
* Please see {@see MarketingplatformAdminServiceClient::organizationName()} for help formatting this field.
40+
*/
41+
function find_sales_partner_managed_clients_sample(string $formattedOrganization): void
42+
{
43+
// Create a client.
44+
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient();
45+
46+
// Prepare the request message.
47+
$request = (new FindSalesPartnerManagedClientsRequest())
48+
->setOrganization($formattedOrganization);
49+
50+
// Call the API and handle any network failures.
51+
try {
52+
/** @var FindSalesPartnerManagedClientsResponse $response */
53+
$response = $marketingplatformAdminServiceClient->findSalesPartnerManagedClients($request);
54+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
55+
} catch (ApiException $ex) {
56+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
57+
}
58+
}
59+
60+
/**
61+
* Helper to execute the sample.
62+
*
63+
* This sample has been automatically generated and should be regarded as a code
64+
* template only. It will require modifications to work:
65+
* - It may require correct/in-range values for request initialization.
66+
* - It may require specifying regional endpoints when creating the service client,
67+
* please see the apiEndpoint client configuration option for more details.
68+
*/
69+
function callSample(): void
70+
{
71+
$formattedOrganization = MarketingplatformAdminServiceClient::organizationName('[ORGANIZATION]');
72+
73+
find_sales_partner_managed_clients_sample($formattedOrganization);
74+
}
75+
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_FindSalesPartnerManagedClients_sync]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_ListOrganizations_sync]
26+
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
27+
use Google\Ads\MarketingPlatform\Admin\V1alpha\ListOrganizationsRequest;
28+
use Google\Ads\MarketingPlatform\Admin\V1alpha\Organization;
29+
use Google\ApiCore\ApiException;
30+
use Google\ApiCore\PagedListResponse;
31+
32+
/**
33+
* Returns a list of organizations that the user has access to.
34+
*
35+
* This sample has been automatically generated and should be regarded as a code
36+
* template only. It will require modifications to work:
37+
* - It may require correct/in-range values for request initialization.
38+
* - It may require specifying regional endpoints when creating the service client,
39+
* please see the apiEndpoint client configuration option for more details.
40+
*/
41+
function list_organizations_sample(): void
42+
{
43+
// Create a client.
44+
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient();
45+
46+
// Prepare the request message.
47+
$request = new ListOrganizationsRequest();
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var PagedListResponse $response */
52+
$response = $marketingplatformAdminServiceClient->listOrganizations($request);
53+
54+
/** @var Organization $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+
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_ListOrganizations_sync]
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_ReportPropertyUsage_sync]
26+
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
27+
use Google\Ads\MarketingPlatform\Admin\V1alpha\ReportPropertyUsageRequest;
28+
use Google\Ads\MarketingPlatform\Admin\V1alpha\ReportPropertyUsageResponse;
29+
use Google\ApiCore\ApiException;
30+
31+
/**
32+
* Get the usage and billing data for properties within the organization for
33+
* the specified month.
34+
*
35+
* Per direct client org, user needs to be OrgAdmin/BillingAdmin on the
36+
* organization in order to view the billing and usage data.
37+
*
38+
* Per sales partner client org, user needs to be OrgAdmin/BillingAdmin on
39+
* the sales partner org in order to view the billing and usage data, or
40+
* OrgAdmin/BillingAdmin on the sales partner client org in order to view the
41+
* usage data only.
42+
*
43+
* @param string $organization Specifies the organization whose property usage will be listed.
44+
*
45+
* Format: organizations/{org_id}
46+
* @param string $month The target month to list property usages.
47+
*
48+
* Format: YYYY-MM. For example, "2025-05"
49+
*/
50+
function report_property_usage_sample(string $organization, string $month): void
51+
{
52+
// Create a client.
53+
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient();
54+
55+
// Prepare the request message.
56+
$request = (new ReportPropertyUsageRequest())
57+
->setOrganization($organization)
58+
->setMonth($month);
59+
60+
// Call the API and handle any network failures.
61+
try {
62+
/** @var ReportPropertyUsageResponse $response */
63+
$response = $marketingplatformAdminServiceClient->reportPropertyUsage($request);
64+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
65+
} catch (ApiException $ex) {
66+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
67+
}
68+
}
69+
70+
/**
71+
* Helper to execute the sample.
72+
*
73+
* This sample has been automatically generated and should be regarded as a code
74+
* template only. It will require modifications to work:
75+
* - It may require correct/in-range values for request initialization.
76+
* - It may require specifying regional endpoints when creating the service client,
77+
* please see the apiEndpoint client configuration option for more details.
78+
*/
79+
function callSample(): void
80+
{
81+
$organization = '[ORGANIZATION]';
82+
$month = '[MONTH]';
83+
84+
report_property_usage_sample($organization, $month);
85+
}
86+
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_ReportPropertyUsage_sync]

AdsMarketingPlatformAdmin/src/V1alpha/AnalyticsPropertyType.php

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AdsMarketingPlatformAdmin/src/V1alpha/AnalyticsServiceLevel.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)