Complete the code to define a GraphQL mutation to update a user's name.
mutation UpdateUserName($id: ID!, $name: String!) {
updateUser(id: $id, input: { name: [1] }) {
id
name
}
}The variable $name is used to pass the new name value in the mutation input.
Complete the code to specify the mutation name correctly.
mutation [1]($id: ID!, $email: String!) {
updateUser(id: $id, input: { email: $email }) {
id
email
}
}Mutation names typically use camelCase starting with a lowercase letter in GraphQL.
Fix the error in the mutation argument to correctly pass the user ID.
mutation updateUser($id: ID!, $name: String!) {
updateUser(id: [1], input: { name: $name }) {
id
name
}
}The user ID must be passed as the variable $id to match the mutation parameter.
Fill both blanks to complete the mutation that updates a user's age and returns the updated age and name.
mutation [1]($id: ID!, $age: Int!) { updateUser(id: $id, input: { age: [2] }) { age name } }
The mutation name is updateUserAge and the age input uses the variable $age.
Fill all three blanks to write a mutation that updates a user's profile with name and email, and returns the id, name, and email.
mutation [1]($id: ID!, $name: String!, $email: String!) { updateUser(id: $id, input: { name: [2], email: [3] }) { id name email } }
The mutation name is updateUserProfile. The input fields use variables $name and $email.