Ana içeriğe geç

updateUser

Tek bir kullanıcı nesnesini güncelleme. 🔐 Bu yöntem yetkilendirme? gerektirir.

Users?.updateUser( body?, langCode? );

Minimal örnek

// 1. Yetkilendirme
await AuthProvider?.auth("email"?, {
"authData": [?
{
"marker": "email_reg",?
"value": "your@email.com",?
},
{
"marker": "password_reg",?
"value": "yourPassword"?
}
]
});

// 2. Kullanıcıyı güncelle
const body = {
"formIdentifier": "reg",?
"authData": [?
{
"marker": "password",?
"value": "yourPassword"?
}
],
"formData": {?
"marker": "last_name",?
"type": "string"?
"value": "Kullanıcı Adı"?
},
"notificationData": {?
"phonePush": ["+99999999999"],?
"phoneSMS": "+99999999999",?
"state": {}?
}
};

const value = await Users.updateUser(body);
Şema

body(gerekli): IUserBody
İstek gövdesi
örnek:

{
"formIdentifier": "reg",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": {
"marker": "last_name",
"type": "string",
"value": "Kullanıcı Adı"
},
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999",
"state": {}
}
}

formIdentifier(gerekli): string
Formun metin tanımlayıcısı.
örnek: "form_12345"

langCode: string
Yerelleştirme için dil kodu. Varsayılan: "en_US".

formData: IAuthFormData | IAuthFormData[]
Form veri nesnesi veya form veri nesneleri dizisi.
örnek:

[
{
"marker": "first_name",
"type": "string",
"value": "John"
},
{
"marker": "last_name",
"type": "string",
"value": "Doe"
}
]

notificationData: nesne
E-posta ve telefon bilgilerini içeren bildirim verilerini içeren nesne.
örnek:

{
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}

state: herhangi bir
Ek durum bilgilerini içeren nesne.
örnek:

{
"key": "value"
}

langCode: string
Dil kodu. Varsayılan: "en_US"
örnek: "en_US"

Bu yöntem yetkilendirilmiş kullanıcının veri nesnesini günceller. Başarılı güncelleme durumunda true (başarısız güncelleme durumunda false) döner.

Farklı türlerde veri ile body parametresi için örnekler

"string", "integer", "float" basit türü ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": {
"en_US": [
{
"marker": "last_name",
"type": "string",
"value": "Федор Иванов"
}
]
},
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
},
"state": {}
}

"date", "dateTime", "time" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"text" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"textWithHeader" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"image" ve "groupOfImages" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"file" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"radioButton" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"list" türünde özellik ile örnek

{
"formIdentifier": "reg",
"langCode": "en_US",
"authData": [
{
"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"
}
}

"entity" (iç içe liste) türünde özellik ile örnek

{
"formIdentifier": "reg",
"authData": [
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "entity-selector",
"type": "entity",
"value": [
1,
2
]
}
],
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+79991234567"
}
}

"timeInterval" türünde özellik ile örnek

{
"formIdentifier": "reg",
"authData": [
{
"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"
}
}

Örnek dönüş

true