All Release Notes

Added GraphQL support for Inventory

11 July 2018
Composable Commerce
HTTP API
Enhancement
GraphQL
  • [GraphQL API] The following types were added in the GraphQL schema: AddInventoryEntryQuantity, ChangeInventoryEntryQuantity, InventoryEntry, InventoryEntryDraft, InventoryEntryQueryResult, InventoryEntryUpdateAction, RemoveInventoryEntryQuantity, SetInventoryEntryCustomField, SetInventoryEntryCustomType, SetInventoryEntryExpectedDelivery, SetInventoryEntryRestockableInDays, SetInventoryEntrySupplyChannel.
  • [GraphQL API] Type Query was changed:
    • Field inventoryEntries was added to Query type
    • Field inventoryEntry was added to Query type
  • [GraphQL API] Type Mutation was changed:
    • Field deleteInventoryEntry was added to Mutation type
    • Field createInventoryEntry was added to Mutation type
    • Field updateInventoryEntry was added to Mutation type

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
}