Skip to content

Instantly share code, notes, and snippets.

@furquanuddin94
Created March 4, 2022 12:38
Show Gist options
  • Save furquanuddin94/88c32c3b78a53ce549021524166d90aa to your computer and use it in GitHub Desktop.
Save furquanuddin94/88c32c3b78a53ce549021524166d90aa to your computer and use it in GitHub Desktop.
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