using System.Collections.Generic; using System.Threading.Tasks; using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; using LCU.Library.Internal.CoreApiWrapperLib.Utilities; using LCU.Library.Internal.CoreApiWrapperLib.Configuration; using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches; namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess { public class BranchDao : BaseCoreDao, IBranchDao { private readonly CoreConfiguration _coreConfiguration; private readonly CoreApiConfiguration _coreApiConfiguration; public BranchDao(ICoreRequest coreRequest, CoreConfiguration coreConfiguration) : base(coreRequest) { _coreConfiguration = coreConfiguration; _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; } /// /// Calls Core API to get all branches. /// Default Included: Graph /// /// IEnumerable public async Task> FindBranches(CoreRequestParameters coreRequestParameters) { var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); var result = await _coreRequest.GetRequestObject>>( _coreApiConfiguration.CoreEndPointConfiguration.Branches, endpointParameters); return result?.MessageBody; } } }