updateUser
Mise à jour d'un seul objet utilisateur. 🔐 Cette méthode nécessite l'autorisation.
Description
Cette méthode met à jour l'objet de données de l'utilisateur autorisé. Elle renvoie une promesse qui se résout en un objet IUserEntity.
Utilisateurs.updateUser(
body*,
body.formIdentifier*,
body.langCode,
body.formData,
body.notificationData,
body.state,
langCode
);
Schéma des paramètres
Schéma
body(obligatoire): IUserBody
Corps de la requête
exemple :
{
"formIdentifier": "reg",
"authData": [
{
"marker": "email_reg",
"value": "your-email@oneentery.cloud"
},
{
"marker": "password_reg",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Nom d'utilisateur"
}
],
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
},
"state": {}
}
body.formIdentifier(obligatoire): string
Identifiant textuel du formulaire.
exemple : "form_12345"
body.langCode: string
Code de langue pour la localisation. Par défaut : "en_US".
body.formData: IAuthFormData | IAuthFormData[]
Objet de données de formulaire ou tableau d'objets de données de formulaire.
exemple :
[
{
"marker": "first_name",
"type": "string",
"value": "John"
},
{
"marker": "last_name",
"type": "string",
"value": "Doe"
}
]
body.notificationData: object
Objet contenant des données de notification, y compris des informations sur l'email et le téléphone.
exemple :
{
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
body.state: any
Objet contenant des informations d'état supplémentaires.
exemple :
{
"key": "value"
}
langCode: string
Code de langue. Par défaut : "en_US"
exemple : "en_US"
Exemples
Exemple minimal
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": "Nom d'utilisateur" } ], "notificationData": { "email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999" }, "state": {}};
const response = await Users.updateUser(body);
Exemples pour le paramètre body avec différents types de données
Exemple avec attribut de type 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 Users.updateUser(body);
Exemple avec attributs de type "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);
Exemple avec attribut de type "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);
Exemple avec un attribut de type "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);
Exemple avec des attributs de type "image" et "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);
Exemple avec attribut de type "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);
Exemple avec attribut de type "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);
Exemple avec attribut de type "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);
Exemple avec un attribut de type "entity" (liste imbriquée)
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);
Exemple avec attribut de type "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);
Exemple de retour
true