const client = new Client()
.setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT)
.setProject(process.env.APPWRITE_PROJECT_ID_KEY)
.setKey(process.env.APPWRITE_API_KEY);
const users = new Users(client);
let user;
if (bodyJson.email) {
user = await users.updateEmail(params.id, bodyJson.email);
}
if (bodyJson.name) {
user = await users.updateName(params.id, bodyJson.name);
}
return {
code: 200,
response: {
user,
},
};