|
| 1 | +// smithy-typescript generated code |
| 2 | +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { getSerdePlugin } from "@smithy/middleware-serde"; |
| 4 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 5 | +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; |
| 6 | + |
| 7 | +import { |
| 8 | + CognitoIdentityProviderClientResolvedConfig, |
| 9 | + ServiceInputTypes, |
| 10 | + ServiceOutputTypes, |
| 11 | +} from "../CognitoIdentityProviderClient"; |
| 12 | +import { commonParams } from "../endpoint/EndpointParameters"; |
| 13 | +import { |
| 14 | + GetTokensFromRefreshTokenRequest, |
| 15 | + GetTokensFromRefreshTokenRequestFilterSensitiveLog, |
| 16 | + GetTokensFromRefreshTokenResponse, |
| 17 | + GetTokensFromRefreshTokenResponseFilterSensitiveLog, |
| 18 | +} from "../models/models_0"; |
| 19 | +import { de_GetTokensFromRefreshTokenCommand, se_GetTokensFromRefreshTokenCommand } from "../protocols/Aws_json1_1"; |
| 20 | + |
| 21 | +/** |
| 22 | + * @public |
| 23 | + */ |
| 24 | +export type { __MetadataBearer }; |
| 25 | +export { $Command }; |
| 26 | +/** |
| 27 | + * @public |
| 28 | + * |
| 29 | + * The input for {@link GetTokensFromRefreshTokenCommand}. |
| 30 | + */ |
| 31 | +export interface GetTokensFromRefreshTokenCommandInput extends GetTokensFromRefreshTokenRequest {} |
| 32 | +/** |
| 33 | + * @public |
| 34 | + * |
| 35 | + * The output of {@link GetTokensFromRefreshTokenCommand}. |
| 36 | + */ |
| 37 | +export interface GetTokensFromRefreshTokenCommandOutput extends GetTokensFromRefreshTokenResponse, __MetadataBearer {} |
| 38 | + |
| 39 | +/** |
| 40 | + * <p>Given a refresh token, issues new ID, access, and optionally refresh tokens for the |
| 41 | + * user who owns the submitted token. This operation issues a new refresh token and |
| 42 | + * invalidates the original refresh token after an optional grace period when refresh token |
| 43 | + * rotation is enabled. If refresh token rotation is disabled, issues new ID and access |
| 44 | + * tokens only.</p> |
| 45 | + * @example |
| 46 | + * Use a bare-bones client and the command you need to make an API call. |
| 47 | + * ```javascript |
| 48 | + * import { CognitoIdentityProviderClient, GetTokensFromRefreshTokenCommand } from "@aws-sdk/client-cognito-identity-provider"; // ES Modules import |
| 49 | + * // const { CognitoIdentityProviderClient, GetTokensFromRefreshTokenCommand } = require("@aws-sdk/client-cognito-identity-provider"); // CommonJS import |
| 50 | + * const client = new CognitoIdentityProviderClient(config); |
| 51 | + * const input = { // GetTokensFromRefreshTokenRequest |
| 52 | + * RefreshToken: "STRING_VALUE", // required |
| 53 | + * ClientId: "STRING_VALUE", // required |
| 54 | + * ClientSecret: "STRING_VALUE", |
| 55 | + * DeviceKey: "STRING_VALUE", |
| 56 | + * ClientMetadata: { // ClientMetadataType |
| 57 | + * "<keys>": "STRING_VALUE", |
| 58 | + * }, |
| 59 | + * }; |
| 60 | + * const command = new GetTokensFromRefreshTokenCommand(input); |
| 61 | + * const response = await client.send(command); |
| 62 | + * // { // GetTokensFromRefreshTokenResponse |
| 63 | + * // AuthenticationResult: { // AuthenticationResultType |
| 64 | + * // AccessToken: "STRING_VALUE", |
| 65 | + * // ExpiresIn: Number("int"), |
| 66 | + * // TokenType: "STRING_VALUE", |
| 67 | + * // RefreshToken: "STRING_VALUE", |
| 68 | + * // IdToken: "STRING_VALUE", |
| 69 | + * // NewDeviceMetadata: { // NewDeviceMetadataType |
| 70 | + * // DeviceKey: "STRING_VALUE", |
| 71 | + * // DeviceGroupKey: "STRING_VALUE", |
| 72 | + * // }, |
| 73 | + * // }, |
| 74 | + * // }; |
| 75 | + * |
| 76 | + * ``` |
| 77 | + * |
| 78 | + * @param GetTokensFromRefreshTokenCommandInput - {@link GetTokensFromRefreshTokenCommandInput} |
| 79 | + * @returns {@link GetTokensFromRefreshTokenCommandOutput} |
| 80 | + * @see {@link GetTokensFromRefreshTokenCommandInput} for command's `input` shape. |
| 81 | + * @see {@link GetTokensFromRefreshTokenCommandOutput} for command's `response` shape. |
| 82 | + * @see {@link CognitoIdentityProviderClientResolvedConfig | config} for CognitoIdentityProviderClient's `config` shape. |
| 83 | + * |
| 84 | + * @throws {@link ForbiddenException} (client fault) |
| 85 | + * <p>This exception is thrown when WAF doesn't allow your request based on a web |
| 86 | + * ACL that's associated with your user pool.</p> |
| 87 | + * |
| 88 | + * @throws {@link InternalErrorException} (server fault) |
| 89 | + * <p>This exception is thrown when Amazon Cognito encounters an internal error.</p> |
| 90 | + * |
| 91 | + * @throws {@link InvalidLambdaResponseException} (client fault) |
| 92 | + * <p>This exception is thrown when Amazon Cognito encounters an invalid Lambda response.</p> |
| 93 | + * |
| 94 | + * @throws {@link InvalidParameterException} (client fault) |
| 95 | + * <p>This exception is thrown when the Amazon Cognito service encounters an invalid |
| 96 | + * parameter.</p> |
| 97 | + * |
| 98 | + * @throws {@link NotAuthorizedException} (client fault) |
| 99 | + * <p>This exception is thrown when a user isn't authorized.</p> |
| 100 | + * |
| 101 | + * @throws {@link RefreshTokenReuseException} (client fault) |
| 102 | + * <p>This exception is throw when your application requests token refresh with a refresh |
| 103 | + * token that has been invalidated by refresh-token rotation.</p> |
| 104 | + * |
| 105 | + * @throws {@link ResourceNotFoundException} (client fault) |
| 106 | + * <p>This exception is thrown when the Amazon Cognito service can't find the requested |
| 107 | + * resource.</p> |
| 108 | + * |
| 109 | + * @throws {@link TooManyRequestsException} (client fault) |
| 110 | + * <p>This exception is thrown when the user has made too many requests for a given |
| 111 | + * operation.</p> |
| 112 | + * |
| 113 | + * @throws {@link UnexpectedLambdaException} (client fault) |
| 114 | + * <p>This exception is thrown when Amazon Cognito encounters an unexpected exception with |
| 115 | + * Lambda.</p> |
| 116 | + * |
| 117 | + * @throws {@link UserLambdaValidationException} (client fault) |
| 118 | + * <p>This exception is thrown when the Amazon Cognito service encounters a user validation exception |
| 119 | + * with the Lambda service.</p> |
| 120 | + * |
| 121 | + * @throws {@link UserNotFoundException} (client fault) |
| 122 | + * <p>This exception is thrown when a user isn't found.</p> |
| 123 | + * |
| 124 | + * @throws {@link CognitoIdentityProviderServiceException} |
| 125 | + * <p>Base exception class for all service exceptions from CognitoIdentityProvider service.</p> |
| 126 | + * |
| 127 | + * |
| 128 | + * @public |
| 129 | + */ |
| 130 | +export class GetTokensFromRefreshTokenCommand extends $Command |
| 131 | + .classBuilder< |
| 132 | + GetTokensFromRefreshTokenCommandInput, |
| 133 | + GetTokensFromRefreshTokenCommandOutput, |
| 134 | + CognitoIdentityProviderClientResolvedConfig, |
| 135 | + ServiceInputTypes, |
| 136 | + ServiceOutputTypes |
| 137 | + >() |
| 138 | + .ep(commonParams) |
| 139 | + .m(function (this: any, Command: any, cs: any, config: CognitoIdentityProviderClientResolvedConfig, o: any) { |
| 140 | + return [ |
| 141 | + getSerdePlugin(config, this.serialize, this.deserialize), |
| 142 | + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), |
| 143 | + ]; |
| 144 | + }) |
| 145 | + .s("AWSCognitoIdentityProviderService", "GetTokensFromRefreshToken", {}) |
| 146 | + .n("CognitoIdentityProviderClient", "GetTokensFromRefreshTokenCommand") |
| 147 | + .f(GetTokensFromRefreshTokenRequestFilterSensitiveLog, GetTokensFromRefreshTokenResponseFilterSensitiveLog) |
| 148 | + .ser(se_GetTokensFromRefreshTokenCommand) |
| 149 | + .de(de_GetTokensFromRefreshTokenCommand) |
| 150 | + .build() { |
| 151 | + /** @internal type navigation helper, not in runtime. */ |
| 152 | + protected declare static __types: { |
| 153 | + api: { |
| 154 | + input: GetTokensFromRefreshTokenRequest; |
| 155 | + output: GetTokensFromRefreshTokenResponse; |
| 156 | + }; |
| 157 | + sdk: { |
| 158 | + input: GetTokensFromRefreshTokenCommandInput; |
| 159 | + output: GetTokensFromRefreshTokenCommandOutput; |
| 160 | + }; |
| 161 | + }; |
| 162 | +} |
0 commit comments