-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into integration-test-suite
- Loading branch information
Showing
587 changed files
with
67,759 additions
and
2,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
deep-copy-regex: | ||
- source: /google/marketingplatform/admin/(v1alpha)/.*-php/(.*) | ||
dest: /owl-bot-staging/AdsMarketingPlatformAdmin/$1/$2 | ||
api-name: AdsMarketingPlatformAdmin |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ $ git clone [email protected]:googleapis/google-cloud-php.git | |
``` | ||
|
||
* Move your changes into the correct location in that library. Library code | ||
belongs in `ShoppingMerchantDatasources/src`, and tests in `ShoppingMerchantDatasources/tests`. | ||
belongs in `AdsMarketingPlatformAdmin/src`, and tests in `AdsMarketingPlatformAdmin/tests`. | ||
|
||
* Push the changes in a new branch to a fork, and open a new pull request | ||
[here](https://github.com/googleapis/google-cloud-php). | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Google Ads Marketing Platform Admin for PHP | ||
|
||
> Idiomatic PHP client for [Google Ads Marketing Platform Admin](https://developers.google.com/analytics/devguides/config/gmp/v1). | ||
[![Latest Stable Version](https://poser.pugx.org/google/ads-marketingplatform-admin/v/stable)](https://packagist.org/packages/google/ads-marketingplatform-admin) [![Packagist](https://img.shields.io/packagist/dm/google/ads-marketingplatform-admin.svg)](https://packagist.org/packages/google/ads-marketingplatform-admin) | ||
|
||
* [API documentation](https://cloud.google.com/php/docs/reference/ads-marketingplatform-admin/latest) | ||
|
||
**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any | ||
support requests, bug reports, or development contributions should be directed to | ||
that project. | ||
|
||
### Installation | ||
|
||
To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). | ||
|
||
Now, install this component: | ||
|
||
```sh | ||
$ composer require google/ads-marketingplatform-admin | ||
``` | ||
|
||
> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) | ||
> for PHP | ||
This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits | ||
offered by gRPC (such as streaming methods) please see our | ||
[gRPC installation guide](https://cloud.google.com/php/grpc). | ||
|
||
### Authentication | ||
|
||
Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information | ||
on authenticating your client. Once authenticated, you'll be ready to start making requests. | ||
|
||
### Sample | ||
|
||
See the [samples directory](https://github.com/googleapis/php-ads-marketingplatform-admin/tree/main/samples) for a canonical list of samples. | ||
|
||
### Version | ||
|
||
This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. | ||
|
||
### Next Steps | ||
|
||
1. Understand the [official documentation](https://developers.google.com/analytics/devguides/config/gmp/v1). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "google/ads-marketingplatform-admin", | ||
"description": "Google Ads Marketing Platform Admin Client for PHP", | ||
"license": "Apache-2.0", | ||
"minimum-stability": "stable", | ||
"autoload": { | ||
"psr-4": { | ||
"Google\\Ads\\MarketingPlatform\\Admin\\": "src", | ||
"GPBMetadata\\Google\\Marketingplatform\\Admin\\": "metadata" | ||
} | ||
}, | ||
"extra": { | ||
"component": { | ||
"id": "ads-marketingplatform-admin", | ||
"path": "AdsMarketingPlatformAdmin", | ||
"target": "googleapis/php-ads-marketingplatform-admin" | ||
} | ||
}, | ||
"require": { | ||
"php": "^8.0", | ||
"google/gax": "^1.34.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.0" | ||
}, | ||
"suggest": { | ||
"ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", | ||
"ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." | ||
} | ||
} |
Binary file added
BIN
+4.17 KB
AdsMarketingPlatformAdmin/metadata/V1Alpha/MarketingplatformAdmin.php
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# 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 | ||
# | ||
# http://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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import logging | ||
from pathlib import Path | ||
import subprocess | ||
|
||
import synthtool as s | ||
from synthtool.languages import php | ||
from synthtool import _tracked_paths | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
src = Path(f"../{php.STAGING_DIR}/AdsMarketingPlatformAdmin").resolve() | ||
dest = Path().resolve() | ||
|
||
# Added so that we can pass copy_excludes in the owlbot_main() call | ||
_tracked_paths.add(src) | ||
|
||
php.owlbot_main(src=src, dest=dest) | ||
|
||
# format generated clients | ||
subprocess.run([ | ||
'npm', | ||
'exec', | ||
'--yes', | ||
'--package=@prettier/plugin-php@^0.16', | ||
'--', | ||
'prettier', | ||
'**/Client/*', | ||
'--write', | ||
'--parser=php', | ||
'--single-quote', | ||
'--print-width=120']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">src/V[!a-zA-Z]*</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Google Ads Marketing Platform Admin Unit Test Suite"> | ||
<directory>tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
94 changes: 94 additions & 0 deletions
94
...min/samples/V1alpha/MarketingplatformAdminServiceClient/create_analytics_account_link.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_CreateAnalyticsAccountLink_sync] | ||
use Google\Ads\MarketingPlatform\Admin\V1alpha\AnalyticsAccountLink; | ||
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient; | ||
use Google\Ads\MarketingPlatform\Admin\V1alpha\CreateAnalyticsAccountLinkRequest; | ||
use Google\ApiCore\ApiException; | ||
|
||
/** | ||
* Creates the link between the Analytics account and the Google Marketing | ||
* Platform organization. | ||
* | ||
* User needs to be an org user, and admin on the Analytics account to create | ||
* the link. If the account is already linked to an organization, user needs | ||
* to unlink the account from the current organization, then try link again. | ||
* | ||
* @param string $formattedParent The parent resource where this Analytics account link will be | ||
* created. Format: organizations/{org_id} | ||
* Please see {@see MarketingplatformAdminServiceClient::organizationName()} for help formatting this field. | ||
* @param string $formattedAnalyticsAccountLinkAnalyticsAccount Immutable. The resource name of the AnalyticsAdmin API account. | ||
* The account ID will be used as the ID of this AnalyticsAccountLink | ||
* resource, which will become the final component of the resource name. | ||
* | ||
* Format: analyticsadmin.googleapis.com/accounts/{account_id} | ||
* Please see {@see MarketingplatformAdminServiceClient::accountName()} for help formatting this field. | ||
*/ | ||
function create_analytics_account_link_sample( | ||
string $formattedParent, | ||
string $formattedAnalyticsAccountLinkAnalyticsAccount | ||
): void { | ||
// Create a client. | ||
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient(); | ||
|
||
// Prepare the request message. | ||
$analyticsAccountLink = (new AnalyticsAccountLink()) | ||
->setAnalyticsAccount($formattedAnalyticsAccountLinkAnalyticsAccount); | ||
$request = (new CreateAnalyticsAccountLinkRequest()) | ||
->setParent($formattedParent) | ||
->setAnalyticsAccountLink($analyticsAccountLink); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var AnalyticsAccountLink $response */ | ||
$response = $marketingplatformAdminServiceClient->createAnalyticsAccountLink($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 | ||
{ | ||
$formattedParent = MarketingplatformAdminServiceClient::organizationName('[ORGANIZATION]'); | ||
$formattedAnalyticsAccountLinkAnalyticsAccount = MarketingplatformAdminServiceClient::accountName( | ||
'[ACCOUNT]' | ||
); | ||
|
||
create_analytics_account_link_sample( | ||
$formattedParent, | ||
$formattedAnalyticsAccountLinkAnalyticsAccount | ||
); | ||
} | ||
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_CreateAnalyticsAccountLink_sync] |
78 changes: 78 additions & 0 deletions
78
...min/samples/V1alpha/MarketingplatformAdminServiceClient/delete_analytics_account_link.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?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 marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_DeleteAnalyticsAccountLink_sync] | ||
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient; | ||
use Google\Ads\MarketingPlatform\Admin\V1alpha\DeleteAnalyticsAccountLinkRequest; | ||
use Google\ApiCore\ApiException; | ||
|
||
/** | ||
* Deletes the AnalyticsAccountLink, which detaches the Analytics account from | ||
* the Google Marketing Platform organization. | ||
* | ||
* User needs to be an org user, and admin on the Analytics account in order | ||
* to delete the link. | ||
* | ||
* @param string $formattedName The name of the Analytics account link to delete. | ||
* Format: | ||
* organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id} | ||
* Please see {@see MarketingplatformAdminServiceClient::analyticsAccountLinkName()} for help formatting this field. | ||
*/ | ||
function delete_analytics_account_link_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteAnalyticsAccountLinkRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
$marketingplatformAdminServiceClient->deleteAnalyticsAccountLink($request); | ||
printf('Call completed successfully.' . PHP_EOL); | ||
} 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 = MarketingplatformAdminServiceClient::analyticsAccountLinkName( | ||
'[ORGANIZATION]', | ||
'[ANALYTICS_ACCOUNT_LINK]' | ||
); | ||
|
||
delete_analytics_account_link_sample($formattedName); | ||
} | ||
// [END marketingplatformadmin_v1alpha_generated_MarketingplatformAdminService_DeleteAnalyticsAccountLink_sync] |
Oops, something went wrong.