/// <summary> /// Reset password /// </summary> /// <param name="userName"></param> /// <param name="resetPassword">New password.</param> /// <returns>Task of ApiResponse (VirtoCommercePlatformCoreSecuritySecurityResult)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommercePlatformCoreSecuritySecurityResult>> SecurityResetPasswordAsyncWithHttpInfo (string userName, VirtoCommercePlatformWebModelSecurityResetPasswordInfo resetPassword) { // verify the required parameter 'userName' is set if (userName == null) throw new ApiException(400, "Missing required parameter 'userName' when calling SecurityResetPassword"); // verify the required parameter 'resetPassword' is set if (resetPassword == null) throw new ApiException(400, "Missing required parameter 'resetPassword' when calling SecurityResetPassword"); var path_ = "/api/platform/security/users/{userName}/resetpassword"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); String postBody = null; // to determine the Accept header String[] http_header_accepts = new String[] { "application/json", "text/json" }; String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts); if (http_header_accept != null) headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts)); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (userName != null) pathParams.Add("userName", Configuration.ApiClient.ParameterToString(userName)); // path parameter postBody = Configuration.ApiClient.Serialize(resetPassword); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling SecurityResetPassword: "******"Error calling SecurityResetPassword: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<VirtoCommercePlatformCoreSecuritySecurityResult>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommercePlatformCoreSecuritySecurityResult) Configuration.ApiClient.Deserialize(response, typeof(VirtoCommercePlatformCoreSecuritySecurityResult))); }
/// <summary> /// Reset password /// </summary> /// <param name="userName"></param> /// <param name="resetPassword">New password.</param> /// <returns>VirtoCommercePlatformCoreSecuritySecurityResult</returns> public VirtoCommercePlatformCoreSecuritySecurityResult SecurityResetPassword (string userName, VirtoCommercePlatformWebModelSecurityResetPasswordInfo resetPassword) { ApiResponse<VirtoCommercePlatformCoreSecuritySecurityResult> response = SecurityResetPasswordWithHttpInfo(userName, resetPassword); return response.Data; }
/// <summary> /// Reset password /// </summary> /// <param name="userName"></param> /// <param name="resetPassword">New password.</param> /// <returns>Task of VirtoCommercePlatformCoreSecuritySecurityResult</returns> public async System.Threading.Tasks.Task<VirtoCommercePlatformCoreSecuritySecurityResult> SecurityResetPasswordAsync (string userName, VirtoCommercePlatformWebModelSecurityResetPasswordInfo resetPassword) { ApiResponse<VirtoCommercePlatformCoreSecuritySecurityResult> response = await SecurityResetPasswordAsyncWithHttpInfo(userName, resetPassword); return response.Data; }
/// <summary> /// Reset password /// </summary> /// <param name="userName"></param> /// <param name="resetPassword">New password.</param> /// <returns>ApiResponse of VirtoCommercePlatformCoreSecuritySecurityResult</returns> public ApiResponse< VirtoCommercePlatformCoreSecuritySecurityResult > SecurityResetPasswordWithHttpInfo (string userName, VirtoCommercePlatformWebModelSecurityResetPasswordInfo resetPassword) { // verify the required parameter 'userName' is set if (userName == null) throw new ApiException(400, "Missing required parameter 'userName' when calling VirtoCommercePlatformApi->SecurityResetPassword"); // verify the required parameter 'resetPassword' is set if (resetPassword == null) throw new ApiException(400, "Missing required parameter 'resetPassword' when calling VirtoCommercePlatformApi->SecurityResetPassword"); var path_ = "/api/platform/security/users/{userName}/resetpassword"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); Object postBody = null; // to determine the Content-Type header String[] httpContentTypes = new String[] { "application/json", "text/json", "application/x-www-form-urlencoded" }; String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes); // to determine the Accept header String[] httpHeaderAccepts = new String[] { "application/json", "text/json" }; String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts); if (httpHeaderAccept != null) headerParams.Add("Accept", httpHeaderAccept); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (userName != null) pathParams.Add("userName", Configuration.ApiClient.ParameterToString(userName)); // path parameter if (resetPassword.GetType() != typeof(byte[])) { postBody = Configuration.ApiClient.Serialize(resetPassword); // http body (model) parameter } else { postBody = resetPassword; // byte array } // make the HTTP request IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, httpContentType); int statusCode = (int) response.StatusCode; if (statusCode >= 400 && (statusCode != 404 || Configuration.ThrowExceptionWhenStatusCodeIs404)) throw new ApiException (statusCode, "Error calling SecurityResetPassword: "******"Error calling SecurityResetPassword: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<VirtoCommercePlatformCoreSecuritySecurityResult>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommercePlatformCoreSecuritySecurityResult) Configuration.ApiClient.Deserialize(response, typeof(VirtoCommercePlatformCoreSecuritySecurityResult))); }