Ana içeriğe geç

updateUser

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

Açıklama

Bu yöntem, yetkilendirilmiş kullanıcının veri nesnesini günceller. Bir IUserEntity nesnesine çözülmekte olan bir Promise döner.

Kullanıcılar.updateUser(

body, body.formIdentifier, body.langCode, body.formData, body.notificationData, body.state, langCode

);

Parametreler şeması

Şema

body(zorunlu): 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": {}
}

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

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

body.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"
}
]

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

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

body.state: any
Ek durum bilgilerini içeren nesne.
örnek:

{
"key": "value"
}

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

Örnekler

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 response = await Kullanıcılar.updateUser(body);

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

"string", "integer", "float" basit türü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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ü ile nitelik örneği

{
"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