updateUser
Actualizando un único objeto de usuario. 🔐 Este método requiere autorización.
Descripción
Este método actualiza el objeto de datos del usuario autorizado. Devuelve una Promesa que se resuelve en un objeto IUserEntity.
Usuarios.updateUser(
body*,
body.formIdentifier*,
body.langCode,
body.formData,
body.notificationData,
body.state,
langCode
);
Esquema de parámetros
Esquema
body(requerido): IUserBody
Cuerpo de la solicitud
ejemplo:
{
"formIdentifier": "reg",
"authData": [
{
"marker": "email_reg",
"value": "tu-correo@oneentery.cloud"
},
{
"marker": "password_reg",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Nombre de usuario"
}
],
"notificationData": {
"email": "ejemplo@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
},
"state": {}
}
body.formIdentifier(requerido): string
Identificador de texto del formulario.
ejemplo: "form_12345"
body.langCode: string
Código de idioma para localización. Predeterminado: "en_US".
body.formData: IAuthFormData | IAuthFormData[]
Objeto de datos del formulario o array de objetos de datos del formulario.
ejemplo:
[
{
"marker": "first_name",
"type": "string",
"value": "Juan"
},
{
"marker": "last_name",
"type": "string",
"value": "Doe"
}
]
body.notificationData: object
Objeto que contiene datos de notificación, incluyendo información de correo electrónico y teléfono.
ejemplo:
{
"email": "ejemplo@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
body.state: any
Objeto que contiene información adicional del estado.
ejemplo:
{
"key": "value"
}
langCode: string
Código de idioma. Predeterminado: "en_US"
ejemplo: "en_US"
Ejemplos
Ejemplo mínimo
await AuthProvider.auth( "email", { "authData": [ { "marker": "email_reg", "value": "tu@correo.com", }, { "marker": "password_reg", "value": "tuContraseña" } ] });
const body = { "formIdentifier": "reg", "authData": [ { "marker": "password", "value": "tuContraseña" } ], "formData": [ { "marker": "last_name", "type": "string", "value": "Nombre de usuario" } ], "notificationData": { "email": "ejemplo@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999" }, "state": {}};
const response = await Usuarios.updateUser(body);
Ejemplos para el parámetro body con diferentes tipos de datos
Ejemplo con atributo de tipo simple "string", "integer", "float"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Федор Иванов"
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
},
"state": {}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributos de tipo "date", "dateTime", "time"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "birthday",
"type": "date",
"value": {
"fullDate": "2024-05-07T21:02:00.000Z",
"formattedValue": "08-05-2024 00:02",
"formatString": "DD-MM-YYYY HH:mm"
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributo de tipo "text"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "text",
"value": {
"htmlValue": "<p>Это я</p>",
"plainValue": "Это я",
"mdValue": "*Это я*",
"params": {
"isImageCompressed": true,
"editorMode": "html"
}
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con un atributo de tipo "textWithHeader"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "textWithHeader",
"value": {
"header": "Заголовок",
"htmlValue": "<p>Это я</p>",
"plainValue": "Это я",
"mdValue": "*Это я*",
"params": {
"isImageCompressed": true,
"editorMode": "html"
}
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributos de tipo "image" y "groupOfImages"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "avatar",
"type": "image",
"value": [
{
"filename": "files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"downloadLink": "http://my-site.com/cloud-static/files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"size": 392585,
"previewLink": "",
"params": {
"isImageCompressed": true
}
}
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributo de tipo "file"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "picture",
"type": "file",
"value": [
{
"filename": "files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"downloadLink": "http://my-site.com/cloud-static/files/project/page/10/image/Screenshot-from-2024-05-02-15-23-14.png",
"size": 392585
}
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributo de tipo "radioButton"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "selector",
"type": "radioButton",
"value": {
"title": "red",
"value": "1",
"extended": {
"value": "красный",
"type": "string"
}
}
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributo de tipo "list"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "selector",
"type": "list",
"value": [
{
"title": "red",
"value": "1",
"extended": {
"value": "красный",
"type": "string"
}
}
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con un atributo de tipo "entity" (lista anidada)
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "entity-selector",
"type": "entity",
"value": [
1,
2
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo con atributo de tipo "timeInterval"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "interval",
"type": "timeInterval",
"value": [
[
"2025-02-11T16:00:00.000Z",
"2025-02-13T16:00:00.000Z"
]
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
};
const response = await Usuarios.updateUser(body);
Ejemplo de retorno
true