Here you can find the missing mutations from the Todo, this gives you the full picture of a full CRUD example.
mutation AddTodoMutation($input: AddTodoInput!) {
addTodo(input: $input) {
todoEdge {
__typename
cursor
node {
complete
id
text
}
}
viewer {
id
totalCount
}
}
}
{
"input": {
"text": "Im a new todo thing",
"clientMutationId": "VXNlcjox"
}
}
{
"data": {
"addTodo": {
"todoEdge": {
"__typename": "TodoEdge",
"cursor": "77",
"node": {
"complete": false,
"id": "VG9kbzo3Nw==",
"text": "Im a new todo thing"
}
},
"viewer": {
"id": "VXNlcjox",
"totalCount": 3
}
}
}
}
Change todo text field, edit mutation example.
mutation RenameTodoMutation($input: RenameTodoInput!) {
renameTodo(input: $input) {
todo {
id
text
}
}
}
{
"input": {
"id": "VG9kbzo2Ng==",
"text": "Updated new name"
}
}
{
"data": {
"renameTodo": {
"todo": {
"id": "VG9kbzo3",
"text": "New name"
}
}
}
}
mutation MarkAllTodosMutation($input: MarkAllTodosInput!) {
markAllTodos(input: $input) {
changedTodos {
id
complete
}
viewer {
id
completedCount
}
}
}
{
"input": {
"complete": true
}
}
{
"data": {
"markAllTodos": {
"changedTodos": [
{
"id": "VG9kbzo3",
"complete": true
},
{
"id": "VG9kbzo4",
"complete": true
}
],
"viewer": {
"id": "VXNlcjptZQ==",
"completedCount": 5
}
}
}
}
mutation RemoveCompletedTodosMutation($input: RemoveCompletedTodosInput!) {
removeCompletedTodos(input: $input) {
deletedTodoIds {
id
}
viewer {
completedCount
totalCount
id
}
}
}
{
"input": []
}
{
"data": {
"removeCompletedTodos": {
"deletedTodoIds": [
{
"id": "VG9kbzo3Mw=="
},
{
"id": "VG9kbzo3NA=="
}
],
"viewer": {
"completedCount": 0,
"totalCount": 2,
"id": "VXNlcjox"
}
}
}
}