Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dev): add samples to README #7964

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions AdsAdManager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\Ads\AdManager\V1\AdUnit;
Google\Ads\AdManager\V1\Client\AdUnitServiceClient;
Google\Ads\AdManager\V1\GetAdUnitRequest;
Google\ApiCore\ApiException;

// Create a client.
$adUnitServiceClient = new AdUnitServiceClient();

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

// Call the API and handle any network failures.
try {
/** @var AdUnit $response */
$response = $adUnitServiceClient->getAdUnit($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/php-ads-ad-manager/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AdsMarketingPlatformAdmin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\Ads\MarketingPlatform\Admin\V1alpha\Client\MarketingplatformAdminServiceClient;
Google\Ads\MarketingPlatform\Admin\V1alpha\GetOrganizationRequest;
Google\Ads\MarketingPlatform\Admin\V1alpha\Organization;
Google\ApiCore\ApiException;

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

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

// Call the API and handle any network failures.
try {
/** @var Organization $response */
$response = $marketingplatformAdminServiceClient->getOrganization($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/php-ads-marketingplatform-admin/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AdvisoryNotifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\AdvisoryNotifications\V1\Client\AdvisoryNotificationsServiceClient;
Google\Cloud\AdvisoryNotifications\V1\GetNotificationRequest;
Google\Cloud\AdvisoryNotifications\V1\Notification;

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

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

// Call the API and handle any network failures.
try {
/** @var Notification $response */
$response = $advisoryNotificationsServiceClient->getNotification($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-advisorynotifications/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AlloyDb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\AlloyDb\V1\Backup;
Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
Google\Cloud\AlloyDb\V1\GetBackupRequest;

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

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

// Call the API and handle any network failures.
try {
/** @var Backup $response */
$response = $alloyDBAdminClient->getBackup($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-alloydb/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions ApiHub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\ApiHub\V1\Api;
Google\Cloud\ApiHub\V1\Client\ApiHubClient;
Google\Cloud\ApiHub\V1\GetApiRequest;

// Create a client.
$apiHubClient = new ApiHubClient();

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

// Call the API and handle any network failures.
try {
/** @var Api $response */
$response = $apiHubClient->getApi($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-apihub/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AppHub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\AppHub\V1\Application;
Google\Cloud\AppHub\V1\Client\AppHubClient;
Google\Cloud\AppHub\V1\GetApplicationRequest;

// Create a client.
$appHubClient = new AppHubClient();

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

// Call the API and handle any network failures.
try {
/** @var Application $response */
$response = $appHubClient->getApplication($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-apphub/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AppsChat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Apps\Chat\V1\Attachment;
Google\Apps\Chat\V1\Client\ChatServiceClient;
Google\Apps\Chat\V1\GetAttachmentRequest;

// Create a client.
$chatServiceClient = new ChatServiceClient();

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

// Call the API and handle any network failures.
try {
/** @var Attachment $response */
$response = $chatServiceClient->getAttachment($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/php-chat/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AppsEventsSubscriptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Apps\Events\Subscriptions\V1\Client\SubscriptionsServiceClient;
Google\Apps\Events\Subscriptions\V1\GetSubscriptionRequest;
Google\Apps\Events\Subscriptions\V1\Subscription;

// Create a client.
$subscriptionsServiceClient = new SubscriptionsServiceClient();

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

// Call the API and handle any network failures.
try {
/** @var Subscription $response */
$response = $subscriptionsServiceClient->getSubscription($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/php-apps-events-subscriptions/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions AppsMeet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Apps\Meet\V2\Client\ConferenceRecordsServiceClient;
Google\Apps\Meet\V2\ConferenceRecord;
Google\Apps\Meet\V2\GetConferenceRecordRequest;

// Create a client.
$conferenceRecordsServiceClient = new ConferenceRecordsServiceClient();

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

// Call the API and handle any network failures.
try {
/** @var ConferenceRecord $response */
$response = $conferenceRecordsServiceClient->getConferenceRecord($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/php-apps-meet/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions BackupDr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\BackupDR\V1\Backup;
Google\Cloud\BackupDR\V1\Client\BackupDRClient;
Google\Cloud\BackupDR\V1\GetBackupRequest;

// Create a client.
$backupDRClient = new BackupDRClient();

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

// Call the API and handle any network failures.
try {
/** @var Backup $response */
$response = $backupDRClient->getBackup($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-backupdr/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions CommerceConsumerProcurement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\Commerce\Consumer\Procurement\V1\Client\ConsumerProcurementServiceClient;
Google\Cloud\Commerce\Consumer\Procurement\V1\GetOrderRequest;
Google\Cloud\Commerce\Consumer\Procurement\V1\Order;

// Create a client.
$consumerProcurementServiceClient = new ConsumerProcurementServiceClient();

// Prepare the request message.
$request = (new GetOrderRequest())
->setName($name);

// Call the API and handle any network failures.
try {
/** @var Order $response */
$response = $consumerProcurementServiceClient->getOrder($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-commerce-consumer-procurement/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
22 changes: 22 additions & 0 deletions ConfidentialComputing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\ConfidentialComputing\V1\Client\ConfidentialComputingClient;
Google\Cloud\Location\GetLocationRequest;
Google\Cloud\Location\Location;

// Create a client.
$confidentialComputingClient = new ConfidentialComputingClient();

// Prepare the request message.
$request = new GetLocationRequest();

// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $confidentialComputingClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-confidentialcomputing/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
23 changes: 23 additions & 0 deletions Config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ on authenticating your client. Once authenticated, you'll be ready to start maki

### Sample

```php
Google\ApiCore\ApiException;
Google\Cloud\Config\V1\Client\ConfigClient;
Google\Cloud\Config\V1\Deployment;
Google\Cloud\Config\V1\GetDeploymentRequest;

// Create a client.
$configClient = new ConfigClient();

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

// Call the API and handle any network failures.
try {
/** @var Deployment $response */
$response = $configClient->getDeployment($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [samples directory](https://github.com/googleapis/google-cloud-php-config/tree/main/samples) for a canonical list of samples.

### Debugging
Expand Down
Loading
Loading