Continuing the discussion from How to send a Comment with GraphQL?:
@Dimitrios.Ververidis the structure of the Commenting API is a moveable feast presently as described by @gjedlicska at the end of the last post.
The recent improvements in text handling to allow for links, emojis and basic formatting necessarily has enforced a change into the text payload of each message. If you have any familiarity with WYSIWYG text editors markup it will look familiar, but by way of example the format I use (which no longer produces errors) is:
/* QUERY */
mutation commentCreate($input: CommentCreateInput!) {
commentCreate(input: $input)
}
/* VARIABLES */
{"input": {
/* THE RESOURCE */
"streamId": "{{STREAM_ID}}",
"resources": [{
"resourceId":"{{COMMIT_ID}}",
"resourceType": "commit"
}],
/* THE COMMENT BLOCK */
"text": {
"type": "doc", // parent wrapper - required
"content" :[
{
"type": "paragraph", // basic sub element
"content": [{"type":"text","text":"{{COMMENT_TEXT}}"}]
}
]
},
/* THE POSITION DATA BLOCK */
"data": {
"location": {
"x": COMMENT_PIN_X, // float
"y": COMMENT_PIN_Y, // float
"z": COMMENT_PIN_Z // float
},
"filters": null,
"camPos": [
CAMERA_X, // float
CAMERA_Y, // float
CAMERA_Z, // float
TARGET_X, // float
TARGET_Y, // float
TARGET_Z, // float
0, // Ortho - Either 0 or 1
1 // Zoom - I'm unsure of the effects
],
"selection": null // Not yet implemented
"sectionBox": SECTION_BOX // { max: {x,yz}, min: {x,y,z}}
},
}
}
There are many more options for formatting the comment available; for now, it is using TipTap
NB: The maths to ensure you associate a good view with your comment are down to you., but its worth knowing that the viewer (like all threejs) defaults to metre
units, regardless of the units of your model stream.
P.s. If you are using the explorer sandbox or Postman or an HTTP call:
/* HEADERS */
{
"Authorization": "Bearer {{PERSONAL_ACCESS_TOKEN}}"
}