Created
March 4, 2022 12:38
-
-
Save furquanuddin94/88c32c3b78a53ce549021524166d90aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package $package$.search | |
private[search] class $Supplier$SearchService( | |
client: $Supplier$Client, | |
requestMapper: Mapper[SearchRequest, $Supplier$SearchRequest], | |
responseMapper: Mapper[$Supplier$SearchResponse, SearchResponse]) extends SearchService { | |
override def search(request: SearchRequest): Future[SearchResponse] = { | |
for { | |
//validate request | |
_ <- requestValidator.validate(request) | |
//map to vendor request | |
vendorRequest <- requestMapper.map(request) | |
//do the api call to vendor | |
vendorResponse <- client.search(vendorRequest) | |
//map vendor response back to your model | |
response <- responseMapper.map(vendorResponse, $supplier$Response) | |
} yield response | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment