async def exchange_code_for_token(
self,
provider: "capo_amplifyuibuilder.types.token_providers.TokenProviders",
request: "capo_amplifyuibuilder.types.exchange_code_for_token_request_body.ExchangeCodeForTokenRequestBody",
*,
config_overrides: Optional[AsyncAmplifyUIBuilderClientConfig] = None,
) -> "capo_amplifyuibuilder.types.exchange_code_for_token_response.ExchangeCodeForTokenResponse":
"""<note> <p>This is for internal use.</p> </note> <p>Amplify uses this action to exchange an access code for a token.</p>
Args:
provider: <p>The third-party provider for the token. The only valid value is <code>figma</code>.</p>
request: <p>Describes the configuration of the request.</p>
Raises:
capo_amplifyuibuilder.errors.invalid_parameter_exception.InvalidParameterException: <p>An invalid or out-of-range value was supplied for the input parameter.</p>
capo_amplifyuibuilder.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_amplifyuibuilder.types.exchange_code_for_token_request.ExchangeCodeForTokenRequest]",
) -> AsyncOperationResponse[
"capo_amplifyuibuilder.types.exchange_code_for_token_response.ExchangeCodeForTokenResponse"
]:
import capo_amplifyuibuilder._operations.amplify_ui_builder.exchange_code_for_token
(
output,
http_response,
) = await capo_amplifyuibuilder._operations.amplify_ui_builder.exchange_code_for_token.async_exchange_code_for_token(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_amplifyuibuilder.types.exchange_code_for_token_request.ExchangeCodeForTokenRequest",
) -> dict[str, Any]:
import capo_amplifyuibuilder.types.exchange_code_for_token_request
return capo_amplifyuibuilder.types.exchange_code_for_token_request.redact_sensitive(
input_
)
def _redact_output(
output: "capo_amplifyuibuilder.types.exchange_code_for_token_response.ExchangeCodeForTokenResponse",
) -> dict[str, Any]:
import capo_amplifyuibuilder.types.exchange_code_for_token_response
return capo_amplifyuibuilder.types.exchange_code_for_token_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"ExchangeCodeForToken",
redact_input=_redact_input,
redact_output=_redact_output,
),
)
input_: capo_amplifyuibuilder.types.exchange_code_for_token_request.ExchangeCodeForTokenRequest = {
"provider": provider,
"request": request,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output