/// <summary> /// Asynchronously request a new password recovery using <see cref="PasswordRecoveryRequestDTO" /> options. /// </summary> /// <param name="options">The options.</param> /// <returns>True if password recovery request is valid, false otherwise.</returns> public virtual async Task <bool> RequestPasswordRecoveryAsync(PasswordRecoveryRequestDTO options) { try { using (var client = this.BaasicClientFactory.Create(this.Configuration)) { var request = new HttpRequestMessage(HttpMethod.Post, client.GetApiUrl(this.ModuleRelativePath)) { Content = JsonFormatter.SerializeToHttpContent(options) }; var response = await client.SendAsync(request); return(response.IsSuccessStatusCode); } } catch (BaasicClientException ex) { if (ex.ErrorCode == (int)HttpStatusCode.NotFound) { return(false); } throw; } catch (Exception) { throw; } }
/// <summary> /// Asynchronously request a new password recovery using <see cref="PasswordRecoveryRequestDTO" /> options. /// </summary> /// <param name="options">The options.</param> /// <returns>True if password recovery request is valid, false otherwise.</returns> public virtual async Task <bool> RequestPasswordRecoveryAsync(PasswordRecoveryRequestDTO options) { using (var client = this.BaasicClientFactory.Create(this.Configuration)) { var request = new HttpRequestMessage(HttpMethod.Post, client.GetApiUrl(true, this.ModuleRelativePath)) { Content = JsonFormatter.SerializeToHttpContent(options) }; var response = await client.SendAsync(request); return(response.IsSuccessStatusCode); } }