I have ServerTime class:
public class ServerTime {
private String time;
public ServerTime(String time) {
this.time = time;
}
public String getTime() {
return time;
}
}
And ServerNetwork class:
public class ServerNetwork {
private String id;
private String name;
public ServerNetwork(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public String getName(){
return name;
}
}
Now what I wanted to do is process this sequentially since I have to supply timestamp to the second api call. So far I have this but I'm unsure how to process the first observable result, like converting it to a timestamp and then using it for the second observable api request.
Observable<ServerNetwork> serverNetworkObservable = apiInterface
.getTime()
.flatMap(time -> apiInterface.getNetworks(time, anothervalue))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread());
How do I go about starting these observables to actually call the api? I'm new to RxJava.