First: This is the first project in which I am using RxJs, I thought I will learn best by using it.
I found this answer: Turning paginated requests into an Observable stream with RxJs But it says in the comments:
You're exceeding the maximum call stack still. At around 430 pages returned. I think recursion might not be the best solution here
I want to query the Youtube Data API, the results come back in pages and I need to paginate through them. I imagined a work flow like this could work: 1)Initiate a call 2)Check if the response has a 'nextPageToken' 3)If it has, do another request to the Youtube API 4)If not, finish
So to do this I could Imagine the following Observables / streams:
FirstRequestStream -A-X--------------->
ResponseStream -A-A-A-A--X-------->
RequestStream -I-A-I-A----------->
A = Action
I = Info from upper stream
X = Termination
(Not sure if this diagram is correct the way I made it)
So the ResponseStream depends on FirstRequestStream and RequestStream(using the merge function). The RequestStream depends on the ResponseStream( is this called a circulating observable ?)
-Is this the right approach ?
-Are 'circulating observables' a good thing, are they even possible ?(I had problems creating one).
-Any other way I should try first?
-Is it possible to create interdependent observable streams ?
Thank you for your help.