/// <summary> /// Authenticates the caller using Basic authentication. Call this endpoint to authenticate the user /// </summary> /// <exception cref="ApiException">Thrown when fails to make API call</exception> /// <param name="authenticationRequest">Details about the user to authenticate.</param> /// <returns>Task of ApiResponse (AuthenticationResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <AuthenticationResponse> > LoginPostAsyncWithHttpInfo(AuthenticationRequest authenticationRequest) { // verify the required parameter 'authenticationRequest' is set if (authenticationRequest == null) { throw new ApiException(400, "Missing required parameter 'authenticationRequest' when calling AuthenticationApi->LoginPost"); } const string localVarPath = "/login"; var localVarPathParams = new Dictionary <string, string>(); var localVarQueryParams = new Dictionary <string, string>(); var localVarHeaderParams = new Dictionary <string, string>(this.ApiClient.DefaultHeader); var localVarFormParams = new Dictionary <string, string>(); Object localVarPostBody = null; // to determine the Content-Type header string[] localVarHttpContentTypes = new string[] { }; string localVarHttpContentType = this.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header string[] localVarHttpHeaderAccepts = new string[] { "application/json" }; string localVarHttpHeaderAccept = this.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (authenticationRequest.GetType() != typeof(byte[])) { localVarPostBody = this.ApiClient.Serialize(authenticationRequest); // http body (model) parameter } else { localVarPostBody = authenticationRequest; // byte array } // make the HTTP authenticationRequest IRestResponse localVarResponse = (IRestResponse)await this.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("LoginPost", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <AuthenticationResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (AuthenticationResponse)this.ApiClient.Deserialize(localVarResponse, typeof(AuthenticationResponse)))); }