signUp
Registro de usuario (❗️Para proveedores con activación de usuario, se envía un código de activación a través del método de notificación correspondiente)
Descripción
El método acepta el cuerpo como un parámetro. Devuelve una Promesa que se resuelve en un objeto ISignUpEntity.
AuthProvider.signUp(
marker*,
body*,
body.formIdentifier*,
body.langCode,
body.authData*,
body.formData*,
formData.marker*,
formData.type*,
formData.value*,
body.notificationData*,
notificationData.email*,
notificationData.phonePush*,
notificationData.phoneSMS,
langCode
);
Esquema de parámetros
Esquema
marker(requerido): string
El identificador de texto del proveedor de autorización
ejemplo: "email"
body(requerido): ISignUpData
Cuerpo de la solicitud
ejemplo:
{
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Name"
}
],
"notificationData": {
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
}
body.formIdentifier(requerido): string
El identificador para el formulario de registro.
ejemplo: "reg"
body.langCode: string
Código de idioma. Predeterminado: "en_US".
body.authData(requerido): Array
Un array de objetos de datos de autenticación, cada uno conteniendo un marcador y su valor correspondiente.
body.formData(requerido): IAuthFormData | IAuthFormData[]
Los datos del formulario para el registro.
formData.marker(requerido): string
Un identificador único para el campo del formulario.
ejemplo: "email"
formData.type(requerido): string
El tipo del campo del formulario, como 'string', 'email', etc.
ejemplo: "string"
formData.value(requerido): string
El valor ingresado en el campo del formulario.
ejemplo: "example@oneentry.cloud"
body.notificationData(requerido): INotificationData
Un objeto que contiene datos de notificación, incluyendo email, phonePush y phoneSMS.
notificationData.email(requerido): string
Email del usuario utilizado para notificaciones.
ejemplo: "example@oneentry.cloud"
notificationData.phonePush(requerido): string[]
Números de teléfono utilizados para notificaciones push.
ejemplo: ["+19999999999"]
notificationData.phoneSMS: string
Número de teléfono utilizado para notificaciones SMS.
ejemplo: "+19999999999"
langCode: string
Código de idioma. Predeterminado: "en_US"
ejemplo: "en_US"
Ejemplos
Ejemplo mínimo
const body = { "formIdentifier": "reg", "authData": [ { "marker": "login", "value": "example@oneentry.cloud" }, { "marker": "password", "value":"12345" } ], "formData": [ { "marker": "last_name", "type": "string", "value": "Nombre" } ], "notificationData": { "email": "example@oneentry.cloud", "phonePush": [ "+99999999999" ], "phoneSMS": "+99999999999" }};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributos de tipos simples formData "string", "integer", "float".
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "last_name",
"type": "string",
"value": "Fyodor Ivanov"
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributos de tipos "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": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributo de tipo "text"
Para un valor de campo de texto, puedes usar uno de tres tipos de valor:
- htmlValue - cadena HTML
- plainValue - cadena
- mdValue - cadena Markdown
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "text",
"value": {
"htmlValue": "<p>This is me</p>",
// "plainValue": "",
// "mdValue": ""
}
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributo tipo "textWithHeader"
Para un valor de campo textWithHeader, puedes usar uno de tres tipos de valor:
- htmlValue - cadena HTML
- plainValue - cadena
- mdValue - cadena Markdown
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
"formData": [
{
"marker": "about",
"type": "textWithHeader",
"value": {
"header": "Header",
"htmlValue": "<p>This is me</p>",
// "plainValue": "",
// "mdValue": ""
}
}
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributos tipo "image" y "groupOfImages"
Si se proporciona un objeto fileQuery en el objeto formData, el archivo se cargará automáticamente en la nube de OneEntry a través del SDK o usa el manejador File.uploadFile() Consulta ejemplo
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "image",
type: "image",
value: [file],
fileQuery: {
type: "page",
entity: "editor",
id: 3492,
},
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributo tipo "file"
Si se proporciona un objeto fileQuery en el objeto formData, el archivo se cargará automáticamente en la nube de OneEntry a través del SDK o usa el manejador File.uploadFile() Consulta ejemplo
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "image",
type: "image",
value: [file],
fileQuery: {
type: "page",
entity: "editor",
id: 3492,
},
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributos tipo "radioButton" y "list"
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "list",
type: "list",
value: ["1"],
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo con atributo tipo "entity" (lista anidada)
const body = {
"formIdentifier": "reg",
"authData": [
{
"marker": "login",
"value": "test"
},
{
"marker": "password",
"value": "12345"
}
],
formData: [
{
marker: "entity",
type: "entity",
value: [2954, 2957],
},
],
"notificationData": {
"email": "your-email@test.zone",
"phonePush": [],
"phoneSMS": "+19991234567"
}
};
const response = await AuthProvider.signUp('email', body);
Ejemplo de respuesta
{
"identifier": "my-id",
"id": 1764,
"createdDate": "1991-08-18T06:18:10.986Z",
"updatedDate": "1967-12-02T16:45:02.051Z",
"version": 10,
"isActive": false,
"isDeleted": false,
"formData": {
"en_US": [
{
"marker": "login",
"type": "string",
"value": "test"
},
{
"marker": "f-name",
"type": "string",
"value": "Ivanov"
}
]
},
"state": {},
"notificationData": {
"email": "test@test.ru",
"phonePush": [],
"phoneSMS": "+89991234567"
},
"locale": "en_US",
"deletedAt": "2023-02-12 10:56",
"rating": {
"value": 4.5,
"like": 10,
"dislike": 2,
"method": "average"
}
}
Esquema de respuesta
Esquema: ISignUpEntity
id: number
El identificador único de la entidad de registro.
ejemplo: 12345
updatedDate: string
La fecha en que se actualizó por última vez la entidad de registro.
ejemplo: "2023-10-01T12:00:00Z"
version: number
El número de versión de la entidad de registro.
ejemplo: 1
identifier: string
Una cadena única que identifica la entidad de registro.
ejemplo: "signup_12345"
isActive: boolean
Indica si la entidad de registro está activa.
ejemplo: true
formData: IAuthFormData[]
Array de datos del formulario.
ejemplo:
[
{
"marker": "first_name",
"value": "John"
}
]
formData.marker: string
Un identificador único para el campo del formulario.
ejemplo: "email"
formData.type: string
El tipo del campo del formulario, como 'string', 'email', etc.
ejemplo: "string"
formData.value: string
El valor ingresado en el campo del formulario.
ejemplo: "example@oneentry.cloud"
notificationData: INotificationData
Un objeto que contiene datos de notificación, incluyendo email, phonePush y phoneSMS.
ejemplo:
{
"email": "example@oneentry.cloud",
"phonePush": [
"+99999999999"
],
"phoneSMS": "+99999999999"
}
notificationData.email: string
Email del usuario utilizado para notificaciones.
ejemplo: "example@oneentry.cloud"
notificationData.phonePush: string[]
Números de teléfono utilizados para notificaciones push.
ejemplo: ["+19999999999"]
notificationData.phoneSMS: string
Número de teléfono utilizado para notificaciones SMS.
ejemplo: "+19999999999"
locale: string
El locale o código de idioma asociado con la entidad de registro.
ejemplo: "en_US"
createdDate: string
La fecha en que se creó la entidad de registro.
ejemplo: "2023-10-01T12:00:00Z"
importId: unknown
Identificador de importación.
ejemplo: null
deletedAt: string | null
Fecha de eliminación o null.
ejemplo: null
isDeleted: boolean
Indica si la entidad está eliminada.
ejemplo: false
state: Record<string, unknown>
Información adicional del estado.
ejemplo:
rating: IRating
Datos de calificación.