Reputation: 12678
I'm not sure exactly what kind of design i'm looking for but basically we have bunch of api calls and some combination of them accomplish a task, so a task can be 1 api call or more api calls.
I want to design a layer so that UI can just call these "tasks" and tasks would be responsible for running the api calls. Also i want to make it so that some tasks can have other tasks as part of it (like run this api call then run this task)
Api calls need to run synchronously and each API call usually passes some data to the next api call.
What's the best design pattern for this kind of situation? Is there already a certain way of doing this?
Upvotes: 1
Views: 116
Reputation: 56497
It seems you need a kind of Façade for the API methods, which works like a Service layer of your Domain.
Upvotes: 1
Reputation: 10357
Sounds like you're looking for the Visitor pattern. In this scenario, your UI would call methods on the Visitor, which would orchestrate calling the "bunch of api calls" :)
Upvotes: 1