20 July 2018
Composable Commerce
HTTP API
Enhancement
CustomersGraphQL
  • [GraphQL API] Following types were added in the GraphQL schema: ChangeCustomerGroupName, CustomerGroupDraft, CustomerGroupUpdateAction, SetCustomerGroupCustomField, SetCustomerGroupCustomType, SetCustomerGroupKey.
  • [GraphQL API] Type CustomerGroup was changed:
    • Field customFieldsRaw was added to CustomerGroup type
  • [GraphQL API] Type Mutation was changed:
    • Field updateCustomerGroup was added to Mutation type
    • Field deleteCustomerGroup was added to Mutation type
    • Field createCustomerGroup was added to Mutation type

Following changes were introduced in the GraphQL schema (in SDL format):

extend type CustomerGroup {
  "This field contains non-typed data. Consider using `customFields` as a typed alternative."
  customFieldsRaw(
    """
    The names of the custom fields to include.

    If neither `includeNames` nor `excludeNames` are provided, then all custom fields are returned.
    """
    includeNames: [String!],

    """
    The names of the custom fields to exclude.

    If neither `includeNames` nor `excludeNames` are provided, then all custom fields are returned.
    """
    excludeNames: [String!]): [RawCustomField!]
}

extend type Mutation {
  createCustomerGroup(draft: CustomerGroupDraft!): CustomerGroup
  deleteCustomerGroup(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String, version: Long!): CustomerGroup
  updateCustomerGroup(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String, version: Long!, actions: [CustomerGroupUpdateAction!]!): CustomerGroup
}

input ChangeCustomerGroupName {
  name: String!
}

input CustomerGroupDraft {
  groupName: String!
  key: String
  custom: CustomFieldsDraft
}

input CustomerGroupUpdateAction {
  changeName: ChangeCustomerGroupName
  setKey: SetCustomerGroupKey
  setCustomType: SetCustomerGroupCustomType
  setCustomField: SetCustomerGroupCustomField
}

input SetCustomerGroupCustomField {
  name: String!
  value: String
}

input SetCustomerGroupCustomType {
  typeId: String
  typeKey: String
  type: ResourceIdentifierInput
  fields: [CustomFieldInput!]
}

input SetCustomerGroupKey {
  key: String
}