generateToken method

Future<GoogleCloudIntegrationsV1alphaGenerateTokenResponse> generateToken({
  1. String? code,
  2. String? gcpProjectId,
  3. String? product,
  4. String? redirectUri,
  5. String? state,
  6. String? $fields,
})

Receives the auth code and auth config id to combine that with the client id and secret to retrieve access tokens from the token endpoint.

Returns either a success or error message when it's done.

Request parameters:

code - The auth code for the given request

gcpProjectId - The gcp project id of the request

product - Which product sends the request Possible string values are:

  • "UNSPECIFIED_PRODUCT"
  • "IP"
  • "APIGEE"
  • "SECURITY"

redirectUri - Redirect uri of the auth code request

state - The auth config id for the given request

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

Completes with a GoogleCloudIntegrationsV1alphaGenerateTokenResponse.

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<GoogleCloudIntegrationsV1alphaGenerateTokenResponse>
    generateToken({
  core.String? code,
  core.String? gcpProjectId,
  core.String? product,
  core.String? redirectUri,
  core.String? state,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (code != null) 'code': [code],
    if (gcpProjectId != null) 'gcpProjectId': [gcpProjectId],
    if (product != null) 'product': [product],
    if (redirectUri != null) 'redirectUri': [redirectUri],
    if (state != null) 'state': [state],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/callback:generateToken';

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