retrieve method

Retrieves authorization credentials for an auth provider, or indicates what action needs to be taken to obtain credentials.

If the token field in the response is populated, credential retrieval was successful. If one of the fields in the result oneof is populated, further action is required to obtain credentials, such as redirecting the user for consent. View comments on RetrieveCredentialsResponse for more information.

request - The metadata request object.

Request parameters:

authProvider - Required. The resource name of the auth provider. Format: projects/{project}/locations/{location}/authProviders/{auth_provider} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/authProviders/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleCloudAgentidentitycredentialsV1RetrieveCredentialsResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<GoogleCloudAgentidentitycredentialsV1RetrieveCredentialsResponse>
retrieve(
  GoogleCloudAgentidentitycredentialsV1RetrieveCredentialsRequest request,
  core.String authProvider, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'v1/' + core.Uri.encodeFull('$authProvider') + '/credentials:retrieve';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return GoogleCloudAgentidentitycredentialsV1RetrieveCredentialsResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}