Open deyaaeldeen opened 3 years ago
This could be done by taking advantage of the processResult
function in the options bag in the LroEngine
class. Text Analytics has an example for such function that processes a pageable results with getPagedAsyncIterator
here: https://github.com/Azure/azure-sdk-for-js/blob/b8f21fc9ca3675c73f6eea6ba0942eeb8084309d/sdk/textanalytics/ai-text-analytics/src/healthLro.ts#L182-L227
Currently we are generating a Short LRO
method for these operations that combine Paging + LRO which are suffixed with AndWait
, these would pollUntilDone
internally and give back the PagedAsyncIterator
.
Implementing this would generate an additional method without the AndWait
suffix, and keep the Short LRO
one. So this would be an additive change and not a breaking change.
I can see this change split in 2 phases
1) Make a change to cswitch to the new paging getPagedAsyncIterator
which would help remove most of the private methods we are generating. This would be a non-breaking change.
2) implement what Deya referenced above
@deyaaeldeen do you think the assesement above is accurate?
@joheredi Yes!
Some APIs are both LROs and the response is pageable. Combining these two features is challenging. Currently, we only generate a method that returns async iterator over pageable results and has the suffix
AndWait
. However, we also need to generate for these APIs another overload that does not have this suffix and returns a poller which eventually will return the async iterator.