Platform Release 11 July 2018

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

extend type Query {
  inventoryEntries(where: String, sort: [String!], limit: Int, offset: Int): InventoryEntryQueryResult!
  inventoryEntry(id: String!): InventoryEntry
}

extend type Mutation {
  createInventoryEntry(draft: InventoryEntryDraft!): InventoryEntry
  deleteInventoryEntry(id: String!, version: Long!): InventoryEntry
  updateInventoryEntry(id: String!, version: Long!, actions: [InventoryEntryUpdateAction!]!): InventoryEntry
}

input AddInventoryEntryQuantity {
  quantity: Long!
}

input ChangeInventoryEntryQuantity {
  quantity: Long!
}

"Inventory allows you to track stock quantity per SKU and optionally per supply channel"
type InventoryEntry {
  id: String!
  version: Long!
  sku: String!
  supplyChannel: Reference
  quantityOnStock: Long!
  availableQuantity: Long!
  restockableInDays: Int
  expectedDelivery: DateTime
  createdAt: DateTime!
  lastModifiedAt: DateTime!

  "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!]
}

input InventoryEntryDraft {
  sku: String!
  quantityOnStock: Long
  restockableInDays: Int
  expectedDelivery: DateTime
  supplyChannel: ReferenceInput
  custom: CustomFieldsDraft
}

type InventoryEntryQueryResult {
  offset: Int!
  count: Int!
  total: Long!
  results: [InventoryEntry!]!
}

input InventoryEntryUpdateAction {
  addQuantity: AddInventoryEntryQuantity
  changeQuantity: ChangeInventoryEntryQuantity
  removeQuantity: RemoveInventoryEntryQuantity
  setRestockableInDays: SetInventoryEntryRestockableInDays
  setExpectedDelivery: SetInventoryEntryExpectedDelivery
  setSupplyChannel: SetInventoryEntrySupplyChannel
  setCustomType: SetInventoryEntryCustomType
  setCustomField: SetInventoryEntryCustomField
}

input RemoveInventoryEntryQuantity {
  quantity: Long!
}

input SetInventoryEntryCustomField {
  name: String!
  value: String
}

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

input SetInventoryEntryExpectedDelivery {
  expectedDelivery: DateTime
}

input SetInventoryEntryRestockableInDays {
  restockableInDays: Int
}

input SetInventoryEntrySupplyChannel {
  supplyChannel: ReferenceInput
}