import { DaffCartItemServiceInterface } from '@daffodil/cart/driver'
The interface responsible for managing the items of a cart.
interface DaffCartItemServiceInterface<T extends DaffCart = DaffCart, U extends DaffCartItemInput = DaffCartItemInput> {
list(cartId: T["id"]): Observable<T['items']>
get(
cartId: T["id"]
item_id: string
): Observable<T['items'][number]>
add(
id: T["id"]
product: U
): Observable<Partial<T>>
update(
cartId: T["id"]
itemId: T["items"][number]["id"]
changes: Partial<T["items"][number]>
): Observable<Partial<T>>
delete(
cartId: T["id"]
itemId: T["items"][number]["id"]
): Observable<Partial<T>>
}
ObservableList all of the available items of a cart
| Parameter | cartId: T["id"] |
|---|---|
| Description |
ObservableGet a specific cart item of a cart.
| Parameter | cartId: T["id"] |
|---|---|
| Description |
| Parameter | item_id: string |
|---|---|
| Description |
Observable> Add something to a cart.
| Parameter | id: T["id"] |
|---|---|
| Description |
| Parameter | product: U |
|---|---|
| Description |
Observable> Update an existing item in a cart
| Parameter | cartId: T["id"] |
|---|---|
| Description |
| Parameter | itemId: T["items"][number]["id"] |
|---|---|
| Description |
| Parameter | changes: Partial |
|---|---|
| Description |
Observable> Remove an item from a cart.
| Parameter | cartId: T["id"] |
|---|---|
| Description |
| Parameter | itemId: T["items"][number]["id"] |
|---|---|
| Description |