Hi @Amerehei,
to get the updated traits from the subscription you would want to use the UpdateTraitsCommand
in addition to the UpdateElementCommand
.
For example
You can set traits on the update mutation and update the x,y:
#update shape properties
mutation myUpdateShape($workspaceId:String!, $x:Float!, $y:Float!, $shapeId:String!){
myShapetraits: updateTraits(workspaceId: $workspaceId, dryRun:false, id: $shapeId, input: {context: "http://schema.org/", content: {testTraits: 1}})
myShape:updateShape(workspaceId:$workspaceId, id:$shapeId, input:{
transform:{x:$x y:$y}
})
{id}
}
And then use the following subscription to listen listen for both shape x,y and update traits:
subscription subscribeToCommand($workspaceId: String!) {
commands(workspaceId: $workspaceId) {
__typename
... on UpdateElementCommand {
##actorId is the user that performed the action:
updateActorId:actorId
clientId
actorType
elementId
data{
... on UpdateShape{
transform{
x y
}
}
}
}
... on UpdateTraitsCommand{
updateTraitsActorId:actorId
clientId
actorType
elementId
traits
}
}
}
with both being returned separately:
{
"data": {
"commands": {
"__typename": "UpdateTraitsCommand",
"updateTraitsActorId": "BC0i0wzZ5Caph7i871Ka",
"clientId": "65822ba15203ed80b8e5d8d7",
"actorType": "USER",
"elementId": "658218535203edf34ee5c1c2",
"traits": {
"http://schema.org/testTraits": 1
}
}
}
}
and
{
"data": {
"commands": {
"__typename": "UpdateElementCommand",
"updateActorId": "BC0i0wzZ5Caph7i871Ka",
"clientId": "65822ba15203ed89bfe5d8d9",
"actorType": "USER",
"elementId": "658218535203edf34ee5c1c2",
"data": {
"transform": {
"x": 100,
"y": 100
}
}
}
}
}