1 November 2019
Composable Commerce
HTTP API
Enhancement
CartsGraphQL

You can now query for ShoppingLists and My Shopping Lists on the GraphQL API.

  • [GraphQL API] Added the following types to the GraphQL schema: ShoppingList, ShoppingListLineItem, ShoppingListQueryInterface, ShoppingListQueryResult, TextLineItem.
  • [GraphQL API] Changed the Me type:
    • Added the shoppingList field to the Me type.
    • Added the shoppingLists field to the Me type.
  • [GraphQL API] Changed the InStoreMe type:
    • Added the shoppingList field to the InStoreMe type.
    • Added the shoppingLists field to the InStoreMe type.
  • [GraphQL API] Changed the Query type:
    • Added the shoppingList field to the Query type.
    • Query object type now implements ShoppingListQueryInterface interface
    • Added the shoppingLists field to the Query type.
  • [GraphQL API] Changed the MeQueryInterface type:
    • Added the shoppingLists field to the MeQueryInterface type.
    • Added the shoppingList field to the MeQueryInterface type.

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Me {
  shoppingList(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): ShoppingList
  shoppingLists(where: String, sort: [String!], limit: Int, offset: Int): ShoppingListQueryResult!
}

extend type InStoreMe {
  shoppingList(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): ShoppingList
  shoppingLists(where: String, sort: [String!], limit: Int, offset: Int): ShoppingListQueryResult!
}

extend type Query {
  shoppingList(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): ShoppingList
  shoppingLists(where: String, sort: [String!], limit: Int, offset: Int): ShoppingListQueryResult!
}

extend interface MeQueryInterface {
  shoppingList(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): ShoppingList
  shoppingLists(where: String, sort: [String!], limit: Int, offset: Int): ShoppingListQueryResult!
}

type ShoppingList implements Versioned {
  key: String
  name(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  nameAllLocales: [LocalizedString!]!
  description(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  descriptionAllLocales: [LocalizedString!]
  slug(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  slugAllLocales: [LocalizedString!]
  customerRef: Reference
  customer: Customer
  anonymousId: String
  lineItems: [ShoppingListLineItem!]!
  textLineItems: [TextLineItem!]!
  custom: CustomFieldsType
  deleteDaysAfterLastModification: Int
  id: String!
  version: Long!
  createdAt: DateTime!
  lastModifiedAt: DateTime!
  createdBy: Initiator
  lastModifiedBy: Initiator
}

type ShoppingListLineItem {
  id: String!
  productId: String!
  variantId: Int
  productTypeRef: Reference!
  productType: ProductTypeDefinition!
  quantity: Int!
  addedAt: DateTime!
  name(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  nameAllLocales: [LocalizedString!]!
  deactivatedAt: DateTime
  custom: CustomFieldsType
  productSlug(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  variant: ProductVariant
}

"Fields to access shopping lists. Includes direct access to a single list and searching for shopping lists."
interface ShoppingListQueryInterface {
  shoppingList(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): ShoppingList
  shoppingLists(where: String, sort: [String!], limit: Int, offset: Int): ShoppingListQueryResult!
}

type ShoppingListQueryResult {
  offset: Int!
  count: Int!
  total: Long!
  results: [ShoppingList!]!
}

type TextLineItem {
  id: String!
  name(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  nameAllLocales: [LocalizedString!]!
  description(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  descriptionAllLocales: [LocalizedString!]
  quantity: Int!
  custom: CustomFieldsType
  addedAt: DateTime!
}