Junior — Senior
Creating an API request chain using coroutines
livecode
Task condition
To work with an external API, there are two suspend functions: the first returns a list of document identifiers, and the second retrieves the document itself by the given identifier. It is required to build a coroutine flow that will sequentially obtain the list of ids, and then load each document, returning the final list of Document objects.
suspend fun fetchIds(): List<String>
suspend fun fetchDocument(docId: String): Document