static IObservable <Unit> AddImages( IAuctionProcedures soap, IImageLookup imgs, Consent c, AuctionHandle a) => Observable.Merge( imgs.Get(a.LotId) .Select(x => soap.AddImage(c, x, a.RequestId)));
static IObservable <BatchProcessResult> Upload(IAuctionProcedures soap, IImageLookup imgs, Consent c, Lot input) => CreateAuction(soap, c, input) .SelectMany(x => Observable.Concat( Observable.Return(Add(x)), AddImages(soap, imgs, c, x).Select(_ => Image(x)), soap.Commit(c, x.RequestId).Select(_ => Commit(x))) );
public static IObservable <IEnumerable <Status> > PollRequestOnQue( IAuctionProcedures soap, Consent c, IObservable <Unit> cue, IObservable <BatchProcessResult> requests) => cue.WithLatestFrom( requests .Where(x => x.Process == Process.Add) .Scan(empty, (ids, r) => ids.Add(r.Auction.RequestId)), (_, rIds) => soap.GetResult(c, rIds)) .Merge();
public static IObservable <AuctionHandle> CreateAuction( IAuctionProcedures soap, Consent c, Lot l) => soap.AddLot(c, l);
public static IObservable <BatchProcessResult> UploadBatch( IAuctionProcedures soap, IImageLookup imgs, Consent c, IEnumerable <Lot> input) => input.ToObservable().SelectMany(x => Upload(soap, imgs, c, x));