BridgeGateway<SUBSCRIBER_MODEL extends DomainModel, PUBLISHER_MODEL extends DomainModel, SUBSCRIBER_INPUT extends DomainInput> constructor

BridgeGateway<SUBSCRIBER_MODEL extends DomainModel, PUBLISHER_MODEL extends DomainModel, SUBSCRIBER_INPUT extends DomainInput>({
  1. required UseCase<Entity> subscriberUseCase,
  2. required UseCase<Entity> publisherUseCase,
})

Implementation

BridgeGateway({
  required UseCase subscriberUseCase,
  required UseCase publisherUseCase,
})  : _subscriberUseCase = subscriberUseCase,
      _publisherUseCase = publisherUseCase {
  _subscriberUseCase.subscribe<SUBSCRIBER_MODEL, SUBSCRIBER_INPUT>(
    (output) {
      return Either<FailureDomainInput, SUBSCRIBER_INPUT>.right(
        onResponse(
          _publisherUseCase.getDomainModel<PUBLISHER_MODEL>(),
        ),
      );
    },
  );
}