Skip to content

Commit 121678e

Browse files
authored
docs: fix all README samples, rename command (#8536)
* docs: fix all samples, rename command * update READMEs for new components
1 parent 08d5bd2 commit 121678e

File tree

213 files changed

+3623
-1481
lines changed

Some content is hidden

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

213 files changed

+3623
-1481
lines changed

AccessApproval/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,30 @@ Please see our [Authentication guide](https://github.com/googleapis/google-cloud
2929
on authenticating your client. Once authenticated, you'll be ready to start making requests.
3030

3131

32+
### Sample
33+
34+
```php
35+
use Google\ApiCore\ApiException;
36+
use Google\Cloud\AccessApproval\V1\AccessApprovalServiceAccount;
37+
use Google\Cloud\AccessApproval\V1\Client\AccessApprovalClient;
38+
use Google\Cloud\AccessApproval\V1\GetAccessApprovalServiceAccountMessage;
39+
40+
// Create a client.
41+
$accessApprovalClient = new AccessApprovalClient();
42+
43+
// Prepare the request message.
44+
$request = new GetAccessApprovalServiceAccountMessage();
45+
46+
// Call the API and handle any network failures.
47+
try {
48+
/** @var AccessApprovalServiceAccount $response */
49+
$response = $accessApprovalClient->getAccessApprovalServiceAccount($request);
50+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
51+
} catch (ApiException $ex) {
52+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
53+
}
54+
```
55+
3256
### Debugging
3357

3458
Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)

AccessContextManager/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,31 @@ please see our [gRPC installation guide](https://cloud.google.com/php/grpc).
2828
Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information
2929
on authenticating your client. Once authenticated, you'll be ready to start making requests.
3030

31+
### Sample
32+
33+
```php
34+
use Google\ApiCore\ApiException;
35+
use Google\Identity\AccessContextManager\V1\AccessLevel;
36+
use Google\Identity\AccessContextManager\V1\Client\AccessContextManagerClient;
37+
use Google\Identity\AccessContextManager\V1\GetAccessLevelRequest;
38+
39+
// Create a client.
40+
$accessContextManagerClient = new AccessContextManagerClient();
41+
42+
// Prepare the request message.
43+
$request = (new GetAccessLevelRequest())
44+
->setName($formattedName);
45+
46+
// Call the API and handle any network failures.
47+
try {
48+
/** @var AccessLevel $response */
49+
$response = $accessContextManagerClient->getAccessLevel($request);
50+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
51+
} catch (ApiException $ex) {
52+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
53+
}
54+
```
55+
3156
### Debugging
3257

3358
Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)

AdsAdManager/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
3535
### Sample
3636

3737
```php
38-
Google\Ads\AdManager\V1\AdUnit;
39-
Google\Ads\AdManager\V1\Client\AdUnitServiceClient;
40-
Google\Ads\AdManager\V1\GetAdUnitRequest;
41-
Google\ApiCore\ApiException;
38+
use Google\Ads\AdManager\V1\AdBreak;
39+
use Google\Ads\AdManager\V1\Client\AdBreakServiceClient;
40+
use Google\Ads\AdManager\V1\GetAdBreakRequest;
41+
use Google\ApiCore\ApiException;
4242

4343
// Create a client.
44-
$adUnitServiceClient = new AdUnitServiceClient();
44+
$adBreakServiceClient = new AdBreakServiceClient();
4545

4646
// Prepare the request message.
47-
$request = (new GetAdUnitRequest())
47+
$request = (new GetAdBreakRequest())
4848
->setName($formattedName);
4949

5050
// Call the API and handle any network failures.
5151
try {
52-
/** @var AdUnit $response */
53-
$response = $adUnitServiceClient->getAdUnit($request);
52+
/** @var AdBreak $response */
53+
$response = $adBreakServiceClient->getAdBreak($request);
5454
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
5555
} catch (ApiException $ex) {
5656
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());

AdsMarketingPlatformAdmin/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
3535
### Sample
3636

3737
```php
38-
Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
39-
Google\Ads\MarketingPlatform\Admin\V1alpha\GetOrganizationRequest;
40-
Google\Ads\MarketingPlatform\Admin\V1alpha\Organization;
41-
Google\ApiCore\ApiException;
38+
use Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
39+
use Google\Ads\MarketingPlatform\Admin\V1alpha\GetOrganizationRequest;
40+
use Google\Ads\MarketingPlatform\Admin\V1alpha\Organization;
41+
use Google\ApiCore\ApiException;
4242

4343
// Create a client.
4444
$marketingplatformAdminServiceClient = new MarketingplatformAdminServiceClient();

AdvisoryNotifications/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
3535
### Sample
3636

3737
```php
38-
Google\ApiCore\ApiException;
39-
Google\Cloud\AdvisoryNotifications\V1\Client\AdvisoryNotificationsServiceClient;
40-
Google\Cloud\AdvisoryNotifications\V1\GetNotificationRequest;
41-
Google\Cloud\AdvisoryNotifications\V1\Notification;
38+
use Google\ApiCore\ApiException;
39+
use Google\Cloud\AdvisoryNotifications\V1\Client\AdvisoryNotificationsServiceClient;
40+
use Google\Cloud\AdvisoryNotifications\V1\GetNotificationRequest;
41+
use Google\Cloud\AdvisoryNotifications\V1\Notification;
4242

4343
// Create a client.
4444
$advisoryNotificationsServiceClient = new AdvisoryNotificationsServiceClient();

AiPlatform/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,30 @@ please see our [gRPC installation guide](https://cloud.google.com/php/grpc).
2828
Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information
2929
on authenticating your client. Once authenticated, you'll be ready to start making requests.
3030

31+
### Sample
32+
33+
```php
34+
use Google\ApiCore\ApiException;
35+
use Google\Cloud\AIPlatform\V1\Client\DataFoundryServiceClient;
36+
use Google\Cloud\Location\GetLocationRequest;
37+
use Google\Cloud\Location\Location;
38+
39+
// Create a client.
40+
$dataFoundryServiceClient = new DataFoundryServiceClient();
41+
42+
// Prepare the request message.
43+
$request = new GetLocationRequest();
44+
45+
// Call the API and handle any network failures.
46+
try {
47+
/** @var Location $response */
48+
$response = $dataFoundryServiceClient->getLocation($request);
49+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
50+
} catch (ApiException $ex) {
51+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
52+
}
53+
```
54+
3155
### Debugging
3256

3357
Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)

AlloyDb/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
3535
### Sample
3636

3737
```php
38-
Google\ApiCore\ApiException;
39-
Google\Cloud\AlloyDb\V1\Backup;
40-
Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
41-
Google\Cloud\AlloyDb\V1\GetBackupRequest;
38+
use Google\ApiCore\ApiException;
39+
use Google\Cloud\AlloyDb\V1\Backup;
40+
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
41+
use Google\Cloud\AlloyDb\V1\GetBackupRequest;
4242

4343
// Create a client.
4444
$alloyDBAdminClient = new AlloyDBAdminClient();

AnalyticsAdmin/README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,25 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
3131
### Sample
3232

3333
```php
34-
require 'vendor/autoload.php';
35-
34+
use Google\Analytics\Admin\V1beta\Account;
3635
use Google\Analytics\Admin\V1beta\Client\AnalyticsAdminServiceClient;
37-
use Google\Analytics\Admin\V1beta\ListAccountsRequest;
38-
39-
$client = new AnalyticsAdminServiceClient();
40-
41-
$request = new ListAccountsRequest();
42-
$accounts = $client->listAccounts($request);
43-
44-
foreach ($accounts as $account) {
45-
print 'Found account: ' . $account->getName() . PHP_EOL;
36+
use Google\Analytics\Admin\V1beta\GetAccountRequest;
37+
use Google\ApiCore\ApiException;
38+
39+
// Create a client.
40+
$analyticsAdminServiceClient = new AnalyticsAdminServiceClient();
41+
42+
// Prepare the request message.
43+
$request = (new GetAccountRequest())
44+
->setName($formattedName);
45+
46+
// Call the API and handle any network failures.
47+
try {
48+
/** @var Account $response */
49+
$response = $analyticsAdminServiceClient->getAccount($request);
50+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
51+
} catch (ApiException $ex) {
52+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
4653
}
4754
```
4855

AnalyticsData/README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,25 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
3131
### Sample
3232

3333
```php
34-
require 'vendor/autoload.php';
35-
34+
use Google\Analytics\Data\V1beta\AudienceExport;
3635
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
37-
use Google\Analytics\Data\V1beta\RunReportRequest;
38-
39-
$client = new BetaAnalyticsDataClient();
40-
41-
$request = new RunReportRequest([
42-
'property' => 'properties/[YOUR_PROPERTY_ID]'
43-
]);
44-
$response = $client->runReport($request);
45-
46-
foreach ($response->getRows() as $row) {
47-
foreach ($row->getDimensionValues() as $dimensionValue) {
48-
print 'Dimension Value: ' . $dimensionValue->getValue() . PHP_EOL;
49-
}
36+
use Google\Analytics\Data\V1beta\GetAudienceExportRequest;
37+
use Google\ApiCore\ApiException;
38+
39+
// Create a client.
40+
$betaAnalyticsDataClient = new BetaAnalyticsDataClient();
41+
42+
// Prepare the request message.
43+
$request = (new GetAudienceExportRequest())
44+
->setName($formattedName);
45+
46+
// Call the API and handle any network failures.
47+
try {
48+
/** @var AudienceExport $response */
49+
$response = $betaAnalyticsDataClient->getAudienceExport($request);
50+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
51+
} catch (ApiException $ex) {
52+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
5053
}
5154
```
5255

ApiGateway/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,31 @@ Please see our [Authentication guide](https://github.com/googleapis/google-cloud
2929
on authenticating your client. Once authenticated, you'll be ready to start making requests.
3030

3131

32+
### Sample
33+
34+
```php
35+
use Google\ApiCore\ApiException;
36+
use Google\Cloud\ApiGateway\V1\Api;
37+
use Google\Cloud\ApiGateway\V1\Client\ApiGatewayServiceClient;
38+
use Google\Cloud\ApiGateway\V1\GetApiRequest;
39+
40+
// Create a client.
41+
$apiGatewayServiceClient = new ApiGatewayServiceClient();
42+
43+
// Prepare the request message.
44+
$request = (new GetApiRequest())
45+
->setName($formattedName);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var Api $response */
50+
$response = $apiGatewayServiceClient->getApi($request);
51+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
52+
} catch (ApiException $ex) {
53+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
54+
}
55+
```
56+
3257
### Debugging
3358

3459
Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)

0 commit comments

Comments
 (0)