|
|
|
|
|
by putnambr
1060 days ago
|
|
Sure - the *Client would be a class or library intended for import/use by consumers of a resource exposed by a service. The exposed API should be viewed as usable independently, but it can sometimes be useful to add a layer of abstraction via a Client to would hold any logic required for interacting with a specific API. Say you have an API that lets you bulk fetch an Item (`getItems(Collection<UUID> itemIds, int pageNumber, int pageSize)`), but the API enforces pagination and also requires authentication. A Client could require instantiation with whatever is required for authentication (`ic = new ItemClient(authToken)`), and provide a method to retrieve a huge list of Items without worrying about pagination (`ic.getItems(itemIds)`). |
|