Skip to content

Commit 5b522c6

Browse files
feat: [Many APIs] usage deprecation of credentials client option (#8605)
* feat: support ClientOptions in client constructor docs: document universeDomain client option docs: add "generic" phpdocs for OperationResponse and ServerStream fix: Update pagination rules for compute clients deps: Update dependency google/protobuf to v4 PiperOrigin-RevId: 807444648 Source-Link: googleapis/googleapis@6288882 Source-Link: googleapis/googleapis-gen@577eee9 Copy-Tag: eyJwIjoiU3RvcmFnZUNvbnRyb2wvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiU3RvcmFnZUluc2lnaHRzLy5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiU3RvcmFnZVRyYW5zZmVyLy5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiU3VwcG9ydC8uT3dsQm90LnlhbWwiLCJoIjoiNTc3ZWVlOTMxYjczZTkxMGZmYWUxYjE3MGY2ZjlmOGJkNzk3NWEzNiJ9 Copy-Tag: eyJwIjoiVGFsZW50Ly5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiVGFza3MvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiVGVsY29BdXRvbWF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiVGV4dFRvU3BlZWNoL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EJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiVm13YXJlRW5naW5lLy5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiVnBjQWNjZXNzLy5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiV2ViUmlzay8uT3dsQm90LnlhbWwiLCJoIjoiNTc3ZWVlOTMxYjczZTkxMGZmYWUxYjE3MGY2ZjlmOGJkNzk3NWEzNiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: usage deprecation of credentials client option PiperOrigin-RevId: 809097824 Source-Link: googleapis/googleapis@e8ed6b4 Source-Link: googleapis/googleapis-gen@96cfee1 Copy-Tag: eyJwIjoiU3RvcmFnZUNvbnRyb2wvLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== Copy-Tag: eyJwIjoiU3RvcmFnZUluc2lnaHRzLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiU3RvcmFnZVRyYW5zZmVyLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiU3VwcG9ydC8uT3dsQm90LnlhbWwiLCJoIjoiOTZjZmVlMTYzOTM2OGUzNGE4ZDFmNzY1Y2VkZGVjZjlkY2ExMTlkYyJ9 Copy-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IjoiVmlkZW9TdGl0Y2hlci8uT3dsQm90LnlhbWwiLCJoIjoiOTZjZmVlMTYzOTM2OGUzNGE4ZDFmNzY1Y2VkZGVjZjlkY2ExMTlkYyJ9 Copy-Tag: eyJwIjoiVmlkZW9UcmFuc2NvZGVyLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiVmlzaW9uLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiVm1NaWdyYXRpb24vLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== Copy-Tag: eyJwIjoiVm13YXJlRW5naW5lLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiVnBjQWNjZXNzLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiV2ViUmlzay8uT3dsQm90LnlhbWwiLCJoIjoiOTZjZmVlMTYzOTM2OGUzNGE4ZDFmNzY1Y2VkZGVjZjlkY2ExMTlkYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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>
1 parent c07b187 commit 5b522c6

28 files changed

Lines changed: 1063 additions & 1187 deletions

File tree

StorageControl/src/V2/Client/StorageControlClient.php

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Google\ApiCore\CredentialsWrapper;
2929
use Google\ApiCore\GapicClientTrait;
3030
use Google\ApiCore\OperationResponse;
31+
use Google\ApiCore\Options\ClientOptions;
3132
use Google\ApiCore\PagedListResponse;
3233
use Google\ApiCore\ResourceHelperTrait;
3334
use Google\ApiCore\RetrySettings;
@@ -187,9 +188,7 @@ public function getOperationsClient()
187188
*/
188189
public function resumeOperation($operationName, $methodName = null)
189190
{
190-
$options = isset($this->descriptors[$methodName]['longRunning'])
191-
? $this->descriptors[$methodName]['longRunning']
192-
: [];
191+
$options = $this->descriptors[$methodName]['longRunning'] ?? [];
193192
$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
194193
$operation->reload();
195194
return $operation;
@@ -408,25 +407,28 @@ public static function parseName(string $formattedName, ?string $template = null
408407
/**
409408
* Constructor.
410409
*
411-
* @param array $options {
410+
* @param array|ClientOptions $options {
412411
* Optional. Options for configuring the service API wrapper.
413412
*
414413
* @type string $apiEndpoint
415414
* The address of the API remote host. May optionally include the port, formatted
416415
* as "<uri>:<port>". Default 'storage.googleapis.com:443'.
417-
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
418-
* The credentials to be used by the client to authorize API calls. This option
419-
* accepts either a path to a credentials file, or a decoded credentials file as a
420-
* PHP array.
421-
* *Advanced usage*: In addition, this option can also accept a pre-constructed
422-
* {@see \Google\Auth\FetchAuthTokenInterface} object or
423-
* {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
424-
* objects are provided, any settings in $credentialsConfig will be ignored.
425-
* *Important*: If you accept a credential configuration (credential
426-
* JSON/File/Stream) from an external source for authentication to Google Cloud
427-
* Platform, you must validate it before providing it to any Google API or library.
428-
* Providing an unvalidated credential configuration to Google APIs can compromise
429-
* the security of your systems and data. For more information {@see
416+
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
417+
* This option should only be used with a pre-constructed
418+
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
419+
* when one of these objects are provided, any settings in $credentialsConfig will
420+
* be ignored.
421+
* **Important**: If you are providing a path to a credentials file, or a decoded
422+
* credentials file as a PHP array, this usage is now DEPRECATED. Providing an
423+
* unvalidated credential configuration to Google APIs can compromise the security
424+
* of your systems and data. It is recommended to create the credentials explicitly
425+
* ```
426+
* use Google\Auth\Credentials\ServiceAccountCredentials;
427+
* use Google\Cloud\Storage\Control\V2\StorageControlClient;
428+
* $creds = new ServiceAccountCredentials($scopes, $json);
429+
* $options = new StorageControlClient(['credentials' => $creds]);
430+
* ```
431+
* {@see
430432
* https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
431433
* @type array $credentialsConfig
432434
* Options used to configure credentials, including auth token caching, for the
@@ -464,11 +466,13 @@ public static function parseName(string $formattedName, ?string $template = null
464466
* @type false|LoggerInterface $logger
465467
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
466468
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
469+
* @type string $universeDomain
470+
* The service domain for the client. Defaults to 'googleapis.com'.
467471
* }
468472
*
469473
* @throws ValidationException
470474
*/
471-
public function __construct(array $options = [])
475+
public function __construct(array|ClientOptions $options = [])
472476
{
473477
$clientOptions = $this->buildClientOptions($options);
474478
$this->setClientOptions($clientOptions);
@@ -503,7 +507,7 @@ public function __call($method, $args)
503507
* {@see RetrySettings} for example usage.
504508
* }
505509
*
506-
* @return OperationResponse
510+
* @return OperationResponse<AnywhereCache>
507511
*
508512
* @throws ApiException Thrown if the API call fails.
509513
*/
@@ -718,10 +722,8 @@ public function getFolder(GetFolderRequest $request, array $callOptions = []): F
718722
*
719723
* @throws ApiException Thrown if the API call fails.
720724
*/
721-
public function getFolderIntelligenceConfig(
722-
GetFolderIntelligenceConfigRequest $request,
723-
array $callOptions = []
724-
): IntelligenceConfig {
725+
public function getFolderIntelligenceConfig(GetFolderIntelligenceConfigRequest $request, array $callOptions = []): IntelligenceConfig
726+
{
725727
return $this->startApiCall('GetFolderIntelligenceConfig', $request, $callOptions)->wait();
726728
}
727729

@@ -803,10 +805,8 @@ public function getManagedFolder(GetManagedFolderRequest $request, array $callOp
803805
*
804806
* @throws ApiException Thrown if the API call fails.
805807
*/
806-
public function getOrganizationIntelligenceConfig(
807-
GetOrganizationIntelligenceConfigRequest $request,
808-
array $callOptions = []
809-
): IntelligenceConfig {
808+
public function getOrganizationIntelligenceConfig(GetOrganizationIntelligenceConfigRequest $request, array $callOptions = []): IntelligenceConfig
809+
{
810810
return $this->startApiCall('GetOrganizationIntelligenceConfig', $request, $callOptions)->wait();
811811
}
812812

@@ -832,10 +832,8 @@ public function getOrganizationIntelligenceConfig(
832832
*
833833
* @throws ApiException Thrown if the API call fails.
834834
*/
835-
public function getProjectIntelligenceConfig(
836-
GetProjectIntelligenceConfigRequest $request,
837-
array $callOptions = []
838-
): IntelligenceConfig {
835+
public function getProjectIntelligenceConfig(GetProjectIntelligenceConfigRequest $request, array $callOptions = []): IntelligenceConfig
836+
{
839837
return $this->startApiCall('GetProjectIntelligenceConfig', $request, $callOptions)->wait();
840838
}
841839

@@ -990,7 +988,7 @@ public function pauseAnywhereCache(PauseAnywhereCacheRequest $request, array $ca
990988
* {@see RetrySettings} for example usage.
991989
* }
992990
*
993-
* @return OperationResponse
991+
* @return OperationResponse<Folder>
994992
*
995993
* @throws ApiException Thrown if the API call fails.
996994
*/
@@ -1082,10 +1080,8 @@ public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions =
10821080
*
10831081
* @throws ApiException Thrown if the API call fails.
10841082
*/
1085-
public function testIamPermissions(
1086-
TestIamPermissionsRequest $request,
1087-
array $callOptions = []
1088-
): TestIamPermissionsResponse {
1083+
public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse
1084+
{
10891085
return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait();
10901086
}
10911087

@@ -1107,7 +1103,7 @@ public function testIamPermissions(
11071103
* {@see RetrySettings} for example usage.
11081104
* }
11091105
*
1110-
* @return OperationResponse
1106+
* @return OperationResponse<AnywhereCache>
11111107
*
11121108
* @throws ApiException Thrown if the API call fails.
11131109
*/
@@ -1138,10 +1134,8 @@ public function updateAnywhereCache(UpdateAnywhereCacheRequest $request, array $
11381134
*
11391135
* @throws ApiException Thrown if the API call fails.
11401136
*/
1141-
public function updateFolderIntelligenceConfig(
1142-
UpdateFolderIntelligenceConfigRequest $request,
1143-
array $callOptions = []
1144-
): IntelligenceConfig {
1137+
public function updateFolderIntelligenceConfig(UpdateFolderIntelligenceConfigRequest $request, array $callOptions = []): IntelligenceConfig
1138+
{
11451139
return $this->startApiCall('UpdateFolderIntelligenceConfig', $request, $callOptions)->wait();
11461140
}
11471141

@@ -1167,10 +1161,8 @@ public function updateFolderIntelligenceConfig(
11671161
*
11681162
* @throws ApiException Thrown if the API call fails.
11691163
*/
1170-
public function updateOrganizationIntelligenceConfig(
1171-
UpdateOrganizationIntelligenceConfigRequest $request,
1172-
array $callOptions = []
1173-
): IntelligenceConfig {
1164+
public function updateOrganizationIntelligenceConfig(UpdateOrganizationIntelligenceConfigRequest $request, array $callOptions = []): IntelligenceConfig
1165+
{
11741166
return $this->startApiCall('UpdateOrganizationIntelligenceConfig', $request, $callOptions)->wait();
11751167
}
11761168

@@ -1196,10 +1188,8 @@ public function updateOrganizationIntelligenceConfig(
11961188
*
11971189
* @throws ApiException Thrown if the API call fails.
11981190
*/
1199-
public function updateProjectIntelligenceConfig(
1200-
UpdateProjectIntelligenceConfigRequest $request,
1201-
array $callOptions = []
1202-
): IntelligenceConfig {
1191+
public function updateProjectIntelligenceConfig(UpdateProjectIntelligenceConfigRequest $request, array $callOptions = []): IntelligenceConfig
1192+
{
12031193
return $this->startApiCall('UpdateProjectIntelligenceConfig', $request, $callOptions)->wait();
12041194
}
12051195
}

StorageInsights/src/V1/Client/StorageInsightsClient.php

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Google\ApiCore\CredentialsWrapper;
2929
use Google\ApiCore\GapicClientTrait;
3030
use Google\ApiCore\OperationResponse;
31+
use Google\ApiCore\Options\ClientOptions;
3132
use Google\ApiCore\PagedListResponse;
3233
use Google\ApiCore\ResourceHelperTrait;
3334
use Google\ApiCore\RetrySettings;
@@ -46,6 +47,7 @@
4647
use Google\Cloud\StorageInsights\V1\GetReportConfigRequest;
4748
use Google\Cloud\StorageInsights\V1\GetReportDetailRequest;
4849
use Google\Cloud\StorageInsights\V1\LinkDatasetRequest;
50+
use Google\Cloud\StorageInsights\V1\LinkDatasetResponse;
4951
use Google\Cloud\StorageInsights\V1\ListDatasetConfigsRequest;
5052
use Google\Cloud\StorageInsights\V1\ListReportConfigsRequest;
5153
use Google\Cloud\StorageInsights\V1\ListReportDetailsRequest;
@@ -112,7 +114,9 @@ final class StorageInsightsClient
112114
private const CODEGEN_NAME = 'gapic';
113115

114116
/** The default scopes required by the service. */
115-
public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform'];
117+
public static $serviceScopes = [
118+
'https://www.googleapis.com/auth/cloud-platform',
119+
];
116120

117121
private $operationsClient;
118122

@@ -158,9 +162,7 @@ public function getOperationsClient()
158162
*/
159163
public function resumeOperation($operationName, $methodName = null)
160164
{
161-
$options = isset($this->descriptors[$methodName]['longRunning'])
162-
? $this->descriptors[$methodName]['longRunning']
163-
: [];
165+
$options = $this->descriptors[$methodName]['longRunning'] ?? [];
164166
$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
165167
$operation->reload();
166168
return $operation;
@@ -251,12 +253,8 @@ public static function reportConfigName(string $project, string $location, strin
251253
*
252254
* @return string The formatted report_detail resource.
253255
*/
254-
public static function reportDetailName(
255-
string $project,
256-
string $location,
257-
string $reportConfig,
258-
string $reportDetail
259-
): string {
256+
public static function reportDetailName(string $project, string $location, string $reportConfig, string $reportDetail): string
257+
{
260258
return self::getPathTemplate('reportDetail')->render([
261259
'project' => $project,
262260
'location' => $location,
@@ -295,25 +293,28 @@ public static function parseName(string $formattedName, ?string $template = null
295293
/**
296294
* Constructor.
297295
*
298-
* @param array $options {
296+
* @param array|ClientOptions $options {
299297
* Optional. Options for configuring the service API wrapper.
300298
*
301299
* @type string $apiEndpoint
302300
* The address of the API remote host. May optionally include the port, formatted
303301
* as "<uri>:<port>". Default 'storageinsights.googleapis.com:443'.
304-
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
305-
* The credentials to be used by the client to authorize API calls. This option
306-
* accepts either a path to a credentials file, or a decoded credentials file as a
307-
* PHP array.
308-
* *Advanced usage*: In addition, this option can also accept a pre-constructed
309-
* {@see \Google\Auth\FetchAuthTokenInterface} object or
310-
* {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
311-
* objects are provided, any settings in $credentialsConfig will be ignored.
312-
* *Important*: If you accept a credential configuration (credential
313-
* JSON/File/Stream) from an external source for authentication to Google Cloud
314-
* Platform, you must validate it before providing it to any Google API or library.
315-
* Providing an unvalidated credential configuration to Google APIs can compromise
316-
* the security of your systems and data. For more information {@see
302+
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
303+
* This option should only be used with a pre-constructed
304+
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
305+
* when one of these objects are provided, any settings in $credentialsConfig will
306+
* be ignored.
307+
* **Important**: If you are providing a path to a credentials file, or a decoded
308+
* credentials file as a PHP array, this usage is now DEPRECATED. Providing an
309+
* unvalidated credential configuration to Google APIs can compromise the security
310+
* of your systems and data. It is recommended to create the credentials explicitly
311+
* ```
312+
* use Google\Auth\Credentials\ServiceAccountCredentials;
313+
* use Google\Cloud\StorageInsights\V1\StorageInsightsClient;
314+
* $creds = new ServiceAccountCredentials($scopes, $json);
315+
* $options = new StorageInsightsClient(['credentials' => $creds]);
316+
* ```
317+
* {@see
317318
* https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
318319
* @type array $credentialsConfig
319320
* Options used to configure credentials, including auth token caching, for the
@@ -351,11 +352,13 @@ public static function parseName(string $formattedName, ?string $template = null
351352
* @type false|LoggerInterface $logger
352353
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
353354
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
355+
* @type string $universeDomain
356+
* The service domain for the client. Defaults to 'googleapis.com'.
354357
* }
355358
*
356359
* @throws ValidationException
357360
*/
358-
public function __construct(array $options = [])
361+
public function __construct(array|ClientOptions $options = [])
359362
{
360363
$clientOptions = $this->buildClientOptions($options);
361364
$this->setClientOptions($clientOptions);
@@ -390,7 +393,7 @@ public function __call($method, $args)
390393
* {@see RetrySettings} for example usage.
391394
* }
392395
*
393-
* @return OperationResponse
396+
* @return OperationResponse<DatasetConfig>
394397
*
395398
* @throws ApiException Thrown if the API call fails.
396399
*/
@@ -442,7 +445,7 @@ public function createReportConfig(CreateReportConfigRequest $request, array $ca
442445
* {@see RetrySettings} for example usage.
443446
* }
444447
*
445-
* @return OperationResponse
448+
* @return OperationResponse<null>
446449
*
447450
* @throws ApiException Thrown if the API call fails.
448451
*/
@@ -570,7 +573,7 @@ public function getReportDetail(GetReportDetailRequest $request, array $callOpti
570573
* {@see RetrySettings} for example usage.
571574
* }
572575
*
573-
* @return OperationResponse
576+
* @return OperationResponse<LinkDatasetResponse>
574577
*
575578
* @throws ApiException Thrown if the API call fails.
576579
*/
@@ -675,7 +678,7 @@ public function listReportDetails(ListReportDetailsRequest $request, array $call
675678
* {@see RetrySettings} for example usage.
676679
* }
677680
*
678-
* @return OperationResponse
681+
* @return OperationResponse<null>
679682
*
680683
* @throws ApiException Thrown if the API call fails.
681684
*/
@@ -701,7 +704,7 @@ public function unlinkDataset(UnlinkDatasetRequest $request, array $callOptions
701704
* {@see RetrySettings} for example usage.
702705
* }
703706
*
704-
* @return OperationResponse
707+
* @return OperationResponse<DatasetConfig>
705708
*
706709
* @throws ApiException Thrown if the API call fails.
707710
*/

0 commit comments

Comments
 (0)