Skip to main content

Mutations

Mutations are for performing any operations which change an entity, e.g., Inserting, Updating or Deleting.

note
  • Using fragments is recommended
  • For better performance always use variables instead of adding parameters directly in the query body

Operations

There are various operations which can be performed which mutate an entity.

Inserting

For some of our more complicated entities such as tasks we will perform a series of calculations to populate unspecified values.

After the calculating is finished we will then perform validation on inputs where appropriate, e.g., does the task exist and is it planned.

If validation has passed then we will commit the changes to the entity, e.g., adding the task and the associated attribute values.

Updating

As with inserting, we will validate the changes and commit them if the validation passes.

Deleting

If the entity is valid to be deleted then we will make all the appropriate changes to remove an entity.

Results

Success

When a mutation has succeeded we will return a type indicating success. This could be just true, the primary key of the updated entity or something more. In most cases you will want to check the ValidationFails collection is empty and if the Error.Messsage property is null or empty.

Validation

If validation has failed we will return a collection of ValidationFails objects.

Unexpected Error

If this has returned, it is unlikely to have been an invalid request. You will see an Error type with a message describing information about the fault.

In this situation we would recommend retrying as these errors could be transient, e.g., a timeout.