/// <summary> /// Gets the contacts. /// </summary> /// <param name="request">The request.</param> /// <returns> /// The contacts. /// </returns> public IEnumerable <Resource> GetContacts(ContactsGetRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } try { var configurationBuilder = this.CreateConfigurationBuilder(); var configReader = ServiceFactory.CreateConfigurationReader(configurationBuilder); var config = configReader.Read(); var service = ServiceFactory.CreateContactService( this.serviceResolver, ConnectionHelper.CreateCosmosUserConnectionInfo(config), ConnectionHelper.CreateCosmosContactConnectionInfo(config), this.logService); var contacts = service.GetContacts(request); this.logService.LogInformation( "Successfully executed Get at {Timestamp}", DateTime.UtcNow); return(contacts); } catch (Exception e) { var errorMessage = $"Fatal exception during Get. ErrorMessage message: {e.Message}"; this.logService.LogError(e, errorMessage); throw; } }
/// <inheritdoc /> public IEnumerable <ContactDocument> GetContacts(ContactsGetRequest request) { return(this.cosmosRepository.GetAllUserContacts(request.UserId)); }