public interface ShoppingListService
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,java.lang.String>> |
cacheKeysToIds(java.util.Set<java.lang.String> shoppingListKeys)
Filters out the keys which are already cached and fetches only the not-cached shopping list
keys from the CTP project defined in an injected
SphereClient and stores a mapping for
every shopping list to id in the cached map of keys -> ids and returns this cached map. |
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.shoppinglists.ShoppingList>> |
createShoppingList(io.sphere.sdk.shoppinglists.ShoppingListDraft shoppingListDraft)
Given a resource draft of type
ShoppingListDraft, this method attempts to create a
resource ShoppingList based on it in the CTP project defined by the sync options. |
java.util.concurrent.CompletionStage<java.util.Set<io.sphere.sdk.shoppinglists.ShoppingList>> |
fetchMatchingShoppingListsByKeys(java.util.Set<java.lang.String> keys)
Given a
Set of shopping list keys, this method fetches a set of all the shopping lists,
matching given set of keys in the CTP project, defined in an injected SphereClient. |
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.shoppinglists.ShoppingList>> |
fetchShoppingList(java.lang.String key)
Given a shopping list key, this method fetches a shopping list that matches given key in the
CTP project defined in a potentially injected
SphereClient. |
java.util.concurrent.CompletionStage<io.sphere.sdk.shoppinglists.ShoppingList> |
updateShoppingList(io.sphere.sdk.shoppinglists.ShoppingList shoppingList,
java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> updateActions)
Given a
ShoppingList and a List<UpdateAction<ShoppingList>>, this method issues an update request with these update actions on this
ShoppingList in the CTP project defined in a potentially injected SphereClient. |
@Nonnull
java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,java.lang.String>> cacheKeysToIds(@Nonnull
java.util.Set<java.lang.String> shoppingListKeys)
SphereClient and stores a mapping for
every shopping list to id in the cached map of keys -> ids and returns this cached map.
Note: If all the supplied keys are already cached, the cached map is returned right away with no request to CTP.
shoppingListKeys - the shopping list keys to fetch and cache the ids for.CompletionStage<Map> in which the result of it's completion
contains a map of all shopping list keys -> ids@Nonnull
java.util.concurrent.CompletionStage<java.util.Set<io.sphere.sdk.shoppinglists.ShoppingList>> fetchMatchingShoppingListsByKeys(@Nonnull
java.util.Set<java.lang.String> keys)
Set of shopping list keys, this method fetches a set of all the shopping lists,
matching given set of keys in the CTP project, defined in an injected SphereClient. A
mapping of the key to the id of the fetched shopping lists is persisted in an in-memory map.keys - set of shopping list keys to fetch matching shopping lists by.CompletionStage<Map> in which the result of it's completion
contains a Set of all matching shopping lists.@Nonnull
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.shoppinglists.ShoppingList>> fetchShoppingList(@Nullable
java.lang.String key)
SphereClient. If there is no matching
shopping list, an empty Optional will be returned in the returned future. A mapping of
the key to the id of the fetched shopping list is persisted in an in-memory map.key - the key of the shopping list to fetch.CompletionStage<Optional> in which the result of it's completion
contains an Optional that contains the matching ShoppingList if exists,
otherwise empty.@Nonnull
java.util.concurrent.CompletionStage<java.util.Optional<io.sphere.sdk.shoppinglists.ShoppingList>> createShoppingList(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingListDraft shoppingListDraft)
ShoppingListDraft, this method attempts to create a
resource ShoppingList based on it in the CTP project defined by the sync options.
A completion stage containing an empty option and the error callback will be triggered in those cases:
On the other hand, if the resource gets created successfully on CTP, then the created
resource's id and key are cached and the method returns a CompletionStage in which the
result of it's completion contains an instance Optional of the resource which was
created.
shoppingListDraft - the resource draft to create a resource based off of.CompletionStage containing an optional with the created resource if
successful otherwise an empty optional.@Nonnull
java.util.concurrent.CompletionStage<io.sphere.sdk.shoppinglists.ShoppingList> updateShoppingList(@Nonnull
io.sphere.sdk.shoppinglists.ShoppingList shoppingList,
@Nonnull
java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.shoppinglists.ShoppingList>> updateActions)
ShoppingList and a List<UpdateAction<ShoppingList>>, this method issues an update request with these update actions on this
ShoppingList in the CTP project defined in a potentially injected SphereClient.
This method returns CompletionStage< ShoppingList> in which the result of
it's completion contains an instance of the ShoppingList which was updated in the CTP
project.shoppingList - the ShoppingList to update.updateActions - the update actions to update the ShoppingList with.CompletionStage<ShoppingList> containing as a result of it's
completion an instance of the ShoppingList which was updated in the CTP project or
a SphereException.