/// <summary> /// Returns info if token has access to specified service. /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <VerifyTokenResponse> VerifyToken(VerifyTokenRequest request) { try { return(await _apiClient.SendRequestAsync <VerifyTokenResponse>("api/tokens/{Id}", request, Method.GET)); } catch (ServiceNotFoundException) { return(null); } }
/// <summary> /// Creates note. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="patientId">The patient identifier.</param> /// <param name="createNote">The note model.</param> /// <param name="token">The security token.</param> /// <returns></returns> public async Task <NoteDetailedResponseDto> CreateNote( int customerId, Guid patientId, BaseNoteDto createNote, string token) { string endpointUrl = string.Format("api/{0}/notes/{1}", customerId, patientId); var response = await apiClient.SendRequestAsync <NoteDetailedResponseDto>(endpointUrl, createNote, Method.POST, null, token); return(response); }
/// <summary> /// Authenticates user through Token Service. /// </summary> /// <param name="credentials">User credentials.</param> /// <param name="clientIpAddress">The client ip address.</param> /// <param name="serverIpAddress">The server ip address.</param> /// <returns> /// True if user authenticated. /// </returns> public async Task <TokenResponseModel> AuthenticateUser( GetTokenRequest credentials, string clientIpAddress, string serverIpAddress ) { return(await _apiClient .SendRequestAsync <TokenResponseModel>( "/api/tokens", credentials, Method.POST, new Dictionary <string, string>() { { "Client-IP", serverIpAddress }, { "Forwarded-For", clientIpAddress } } )); }
/// <summary> /// Gets the thresholds. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="patientId">The patient identifier.</param> /// <param name="thresholdSearchRequest">The search threshold request.</param> /// <param name="bearerToken">The bearer token.</param> /// <returns></returns> public async Task <IList <BaseThresholdDto> > GetThresholds( int customerId, Guid patientId, ThresholdsSearchDto thresholdSearchRequest, string bearerToken ) { var parametersQueryStrings = new List <string>(); if (thresholdSearchRequest != null && thresholdSearchRequest.Mode.HasValue) { parametersQueryStrings.Add(string.Format("mode={0}", thresholdSearchRequest.Mode.Value)); } if (thresholdSearchRequest != null && thresholdSearchRequest.ConditionIds != null && thresholdSearchRequest.ConditionIds.Any()) { parametersQueryStrings.AddRange(thresholdSearchRequest.ConditionIds.Select(c => string.Format("condition={0}", c))); } if (thresholdSearchRequest != null && !string.IsNullOrEmpty(thresholdSearchRequest.Q)) { parametersQueryStrings.Add(string.Format("q={0}", thresholdSearchRequest.Q)); } if (thresholdSearchRequest != null && thresholdSearchRequest.Skip > 0) { parametersQueryStrings.Add(string.Format("skip={0}", thresholdSearchRequest.Skip)); } if (thresholdSearchRequest != null && thresholdSearchRequest.Take > 0) { parametersQueryStrings.Add(string.Format("take={0}", thresholdSearchRequest.Take)); } var queryString = parametersQueryStrings.Aggregate((s1, s2) => string.Format("{0}&{1}", s1, s2)); string endpointUrl = string.Format("api/{0}/thresholds/{1}?{2}", customerId, patientId, queryString); var response = await apiClient.SendRequestAsync <PagedResult <BaseThresholdDto> >(endpointUrl, null, Method.GET, null, bearerToken); return(response.Results); }
/// <summary> /// Loads list of selection answer sets from health library. /// </summary> /// <param name="request"></param> /// <param name="token"></param> /// <returns></returns> public async Task <IList <QuestionElementResponseDto> > FindQuestionElements( SearchRequestDto request, string token ) { var pagedResult = await apiClient .SendRequestAsync <PagedResult <QuestionElementResponseDto> >( "/api/{CustomerId}/question-elements", request, Method.GET, null, token ); return(pagedResult.Results); }
/// <summary> /// Creates the patient. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="request">The request.</param> /// <param name="bearerToken">The bearer token.</param> /// <returns></returns> public async Task <PostResponseDto <Guid> > CreatePatient( int customerId, CreatePatientRequestDto request, string bearerToken ) { string endpointUrl = string.Format("api/{0}", customerId); var response = await apiClient.SendRequestAsync <PostResponseDto <Guid> >( endpointUrl, request, Method.POST, null, bearerToken ); return(response); }
/// <summary> /// Authenticates user through Token Service. /// </summary> /// <param name="credentials">User credentials.</param> /// <returns>True if user authenticated.</returns> public async Task <GetTokenResponse> AuthenticateUser(GetTokenRequest credentials) { return(await _apiClient.SendRequestAsync <GetTokenResponse>("api/tokens", credentials, Method.POST, "")); }
/// <summary> /// Creates the customer. /// </summary> /// <param name="createCustomerData">The create customer data.</param> /// <param name="bearerToken">The bearer token.</param> /// <returns></returns> public async Task <PostResponseDto <int> > CreateCustomer(CreateCustomerRequestDto createCustomerData, string bearerToken) { return(await _apiClient.SendRequestAsync <PostResponseDto <int> >("api/customers", createCustomerData, Method.POST, null, bearerToken)); }
/// <summary> /// Creates the specified create device dto. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="request">The request.</param> /// <param name="bearerToken">The bearer token.</param> /// <returns></returns> public async Task <PostResponseDto <Guid> > CreateDevice(int customerId, CreateDeviceRequestDto request, string bearerToken) { return(await apiClient.SendRequestAsync <PostResponseDto <Guid> >(string.Format("/api/{0}/devices", customerId), request, Method.POST, null, bearerToken)); }