Skip to main content

favoriteListClearItems

Clear all or specific types of items from a favorite list.

Removes all products and/or clusters from the favorite list based on the specified parameters. This is a bulk operation useful for cleanup or resetting list contents.

Clearing process includes:

  • Selective removal based on item type flags
  • Atomic operation ensuring data consistency
  • Preservation of list metadata and ownership
  • Complete removal of specified item types

The operation provides granular control over what gets cleared:

  • Clear products only: Set products=true, clusters=false/omitted
  • Clear clusters only: Set clusters=true, products=false/omitted
  • Clear everything: Set both products=true and clusters=true
  • Clear nothing: Set both to false or omit both (no-op)

Default behavior when both parameters are omitted is to preserve all items (no clearing occurs). This prevents accidental data loss from unintentional calls.

The operation is irreversible for the cleared items, but the list structure and metadata remain intact. Items can be re-added after clearing using the add items operation.

Validation constraints:

  • At least one parameter should be true for meaningful operation
  • Boolean values are parsed and validated automatically

Possible errors:

  • FAVORITE_LISTS_NOT_FOUND_ERROR: Favorite list with the specified ID does not exist
  • FAVORITE_LISTS_INVALID_INPUT_ERROR: Invalid parameter values or validation failure
  • FAVORITE_LISTS_UNKNOWN_ERROR: Unexpected system error during clearing operation

AUTH: Role=[system] OR ('user is authenticated')

favoriteListClearItems(
id: String!
products: Boolean
clusters: Boolean
): FavoriteList!

Arguments

favoriteListClearItems.id ● String! non-null scalar

Unique identifier of the favorite list to modify.

Must be a valid MongoDB ObjectId string with length of 12 or 24 characters representing an existing favorite list. The ObjectId format is validated automatically and will return an error for invalid formats.

Validation constraints:

  • Required field (cannot be null or empty)
  • Must be valid ObjectId format (hexadecimal string)
  • Must reference an existing favorite list in the system

favoriteListClearItems.products ● Boolean scalar

Controls whether to clear all products from the favorite list.

When set to true, removes all individual products from the list completely. When set to false or omitted, products are preserved and remain in the list.

Default behavior: false (products are preserved)

favoriteListClearItems.clusters ● Boolean scalar

Controls whether to clear all product clusters from the favorite list.

When set to true, removes all product clusters from the list completely. When set to false or omitted, clusters are preserved and remain in the list.

Default behavior: false (clusters are preserved)

Type

FavoriteList object

Favorite list entity for GraphQL federation.

Represents a customer's favorite list containing saved products and clusters for easy access and future purchasing. Used for managing customer preferences and providing personalized shopping experiences across federated services.