createRecoveryLinkForIdentity method
Create a Recovery Link This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account.
Parameters:
returnTo
createRecoveryLinkForIdentityBody
cancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
that can be used to get the receive progress
Returns a Future containing a Response
with a RecoveryLinkForIdentity as data
Throws DioError
if API call or serialization fails
Implementation
Future<Response<RecoveryLinkForIdentity>> createRecoveryLinkForIdentity({
String? returnTo,
CreateRecoveryLinkForIdentityBody? createRecoveryLinkForIdentityBody,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/admin/recovery/link';
final _options = Options(
method: r'POST',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'apiKey',
'name': 'oryAccessToken',
'keyName': 'Authorization',
'where': 'header',
},
],
...?extra,
},
contentType: 'application/json',
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (returnTo != null) r'return_to': encodeQueryParameter(_serializers, returnTo, const FullType(String)),
};
dynamic _bodyData;
try {
const _type = FullType(CreateRecoveryLinkForIdentityBody);
_bodyData = createRecoveryLinkForIdentityBody == null ? null : _serializers.serialize(createRecoveryLinkForIdentityBody, specifiedType: _type);
} catch(error, stackTrace) {
throw DioError(
requestOptions: _options.compose(
_dio.options,
_path,
queryParameters: _queryParameters,
),
type: DioErrorType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final _response = await _dio.request<Object>(
_path,
data: _bodyData,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
RecoveryLinkForIdentity? _responseData;
try {
final rawResponse = _response.data;
_responseData = rawResponse == null ? null : _serializers.deserialize(
rawResponse,
specifiedType: const FullType(RecoveryLinkForIdentity),
) as RecoveryLinkForIdentity;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<RecoveryLinkForIdentity>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}