In the previous post, we have seen implementing User defined functions using delete API.
Let’s check how to use the createAccount
API to create an account using the User Defined Function.
Example
Here is a createStudentAccount
function to create a Student account. It uses the createAccount
API to create a student Account.
type Mutation {
createStudentAccount( value: AccountInput! ): Hypi @tan(type:Groovy, inline: """return createAccount(value)""")
}
Let’s execute the function!
mutation {
createStudentAccount(
value: {
username: "low-code"
password: { value: "[email protected]" }
emails: [{ value: "[email protected]" }]
}
) {
id
created
createdBy
}
}
#result
{
"data": {
"createStudentAccount": {
"id": "01F9V9JVG571TCQ11KSM7Y5PR5",
"created": "2021-31-12T12:16:44Z",
"createdBy": "01F9V9JVG571TCQ11KSM7Y5PR5"
}
}
}