updateUser
Atualizando um único objeto de usuário. 🔐 Este método requer autorização.
Descrição
Este método atualiza o objeto de dados do usuário autorizado. Ele retorna uma Promise que resolve para um objeto IUserEntity.
Users.updateUser(
body*,
body.formIdentifier*,
body.langCode,
body.authData,
body.formData,
body.notificationData,
body.state,
langCode
);
Esquema de parâmetros
Esquema
body(obrigatório): IUserBody
Corpo da requisição
exemplo:
{
"formIdentifier": "reg",
"authData": [
{
"marker": "email_reg",
"value": "your-email@oneentery.cloud"
},
{
"marker": "password_reg",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Username"
}
],
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
},
"state": {}
}
body.formIdentifier(obrigatório): string
Identificador de texto do formulário.
exemplo: "form_12345"
body.langCode: string
Código de idioma para localização. Padrão: "en_US".
body.authData: IAuthData[]
Array de objetos de dados de autenticação com marcadores e valores.
exemplo:
[
{
"marker": "password",
"value": "12345"
}
]
authData.marker(obrigatório): string
O marcador identificando o campo de autenticação.
exemplo: "login"
authData.value(obrigatório): string
O valor do campo de autenticação.
exemplo: .com"
body.formData: IAuthFormData | IAuthFormData[]
Objeto de dados do formulário ou array de objetos de dados do formulário.
exemplo:
[
{
"marker": "first_name",
"type": "string",
"value": "John"
},
{
"marker": "last_name",
"type": "string",
"value": "Doe"
}
]
formData.marker(obrigatório): string
Um identificador único para o campo do formulário.
exemplo: "email"
formData.type(obrigatório): string
O tipo do campo do formulário, como 'string', 'email', etc.
exemplo: "string"
formData.value(obrigatório): string
O valor inserido no campo do formulário.
exemplo: "example@oneentry.cloud"
body.notificationData: object
Objeto contendo dados de notificação, incluindo informações de e-mail e telefone.
exemplo:
{
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
body.state: object
Objeto contendo informações adicionais de estado.
exemplo:
{
"key": "value"
}
langCode: string
Código de idioma. Padrão: "en_US"
exemplo: "en_US"
Exemplos
Exemplo mínimo
await AuthProvider.auth( "email", { "authData": [ { "marker": "email_reg", "value": "your@email.com", }, { "marker": "password_reg", "value": "yourPassword" } ] });
const body = { "formIdentifier": "reg", "authData": [ { "marker": "password", "value": "yourPassword" } ], "formData": [ { "marker": "last_name", "type": "string", "value": "Username" } ], "notificationData": { "email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999" }, "state": {}};
const response = await Users.updateUser(body);
Exemplos para o parâmetro body com diferentes tipos de dados
Exemplo com atributo de tipo simples "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 Users.updateUser(body);
Exemplo com 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 Users.updateUser(body);
Exemplo com 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 Users.updateUser(body);
Exemplo com um 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 Users.updateUser(body);
Exemplo com atributos de tipo "image" e "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 Users.updateUser(body);
Exemplo com 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 Users.updateUser(body);
Exemplo com 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 Users.updateUser(body);
Exemplo com 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 Users.updateUser(body);
Exemplo com um atributo de tipo "entity" (lista aninhada)
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 Users.updateUser(body);
Exemplo com 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 Users.updateUser(body);
Exemplo de retorno
true