public void GenerateAuthHeaderValue() { var authenticator = new Authenticator(base.Config.Credentials); var requestBody = new GetModifiedProductsRequest(base.Config.Credentials, DateTime.UtcNow.AddMonths(-1)); var headerValue = authenticator.GetAuthorizationHeaderValue(requestBody.ToJson()); headerValue.Should().NotBeNullOrEmpty(); }
private async Task <IEnumerable <MivaProduct> > CollectProductsFromPage(DateTime lastModifiedDateUtc, int pageIndex, int pageSize, CancellationToken token, Mark mark) { var request = new GetModifiedProductsRequest(base.Config.Credentials, lastModifiedDateUtc); request.SetPage(pageIndex, pageSize); var response = await base.PostAsync <MivaDataResponse <IEnumerable <Product> > >(request, token, mark).ConfigureAwait(false); if (response.Success == 0) { throw new MivaException(response.ErrorMessage, response.ErrorCode); } if (response.Data?.Data != null) { return(response.Data.Data.Select(r => r.ToSVProduct(base.Config.Credentials))); } return(Array.Empty <MivaProduct>()); }