17 February 2020
Composable Commerce
HTTP API
Enhancement
ExtensibilityGraphQL

States can now be modified using the GraphQL API.

  • [GraphQL API] Added the following types to the GraphQL schema: StateDraft, StateUpdateAction, AddStateRoles, ChangeStateInitial, ChangeStateKey, ChangeStateType, SetStateDescription, SetStateName, SetStateRoles, SetStateTransitions, RemoveStateRoles.

  • [GraphQL API] Changed the Mutation type:

    • Added the createState field to the Mutation type.
    • Added the updateState field to the Mutation type.
    • Added the deleteState field to the Mutation type.

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

extend type Mutation {
  createState(draft: StateDraft!): State

  updateState(version: Long!, actions: [StateUpdateAction!]!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): State

  deleteState(version: Long!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): State
}

input StateDraft {
  key: String!
  type: StateType!
  name: [LocalizedStringItemInputType!]
  description: [LocalizedStringItemInputType!]
  initial: Boolean
  roles: [StateRole!]
  transitions: [ReferenceInput!]
}

input StateUpdateAction {
  addRoles: AddStateRoles
  changeInitial: ChangeStateInitial
  changeKey: ChangeStateKey
  changeType: ChangeStateType
  removeRoles: RemoveStateRoles
  setDescription: SetStateDescription
  setName: SetStateName
  setRoles: SetStateRoles
  setTransitions: SetStateTransitions
}

input AddStateRoles {
  roles: [StateRole!]!
}

input ChangeStateInitial {
  initial: Boolean!
}

input ChangeStateKey {
  key: String!
}

input ChangeStateType {
  type: StateType!
}

input SetStateDescription {
  description: [LocalizedStringItemInputType!]
}

input SetStateName {
  name: [LocalizedStringItemInputType!]
}

input SetStateRoles {
  roles: [StateRole!]!
}

input SetStateTransitions {
  transitions: [ResourceIdentifierInput!]
}

input RemoveStateRoles {
  roles: [StateRole!]!
}