Actualizar un usuario
En este fragmento de código aprenderá a actualizar los datos de un usuario.
Ejemplo
Asegúrese de que las siguientes variables se ajustan a los valores requeridos utilizando cualquier método conveniente:
| Clave | Descripción |
|---|---|
USER_ID | The unique ID of the User. |
USER_NEW_NAME | The new name of the User. |
USER_NEW_DISPLAY_NAME | The new display name of the User. |
Requisitos previos
You will need to use an existing Application and have a User in order to be able to update a User. See the Create Conversation code snippet for information on how to create an Application. See also the Create User code snippet on how to create a User.
Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Requisitos previos
You will need to use an existing Application and have a User in order to be able to update a User. See the Create Conversation code snippet for information on how to create an Application. See also the Create User code snippet on how to create a User.
Crea un archivo llamado update-user.js y añade el siguiente código:
Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Requisitos previos
You will need to use an existing Application and have a User in order to be able to update a User. See the Create Conversation code snippet for information on how to create an Application. See also the Create User code snippet on how to create a User.
Añada lo siguiente a build.gradle:
implementation 'com.vonage:server-sdk-kotlin:2.1.1'Crea un archivo llamado UpdateUser y añade el siguiente código al método main:
Ejecute su código
Podemos utilizar el plugin aplicación para Gradle para simplificar la ejecución de nuestra aplicación. Actualiza tu build.gradle con lo siguiente:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Ejecute el siguiente comando gradle para ejecutar su aplicación, sustituyendo com.vonage.quickstart.kt.users por el paquete que contiene UpdateUser:
Requisitos previos
You will need to use an existing Application and have a User in order to be able to update a User. See the Create Conversation code snippet for information on how to create an Application. See also the Create User code snippet on how to create a User.
Añada lo siguiente a build.gradle:
implementation 'com.vonage:server-sdk:9.3.1'Crea un archivo llamado UpdateUser y añade el siguiente código al método main:
Ejecute su código
Podemos utilizar el plugin aplicación para Gradle para simplificar la ejecución de nuestra aplicación. Actualiza tu build.gradle con lo siguiente:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Ejecute el siguiente comando gradle para ejecutar su aplicación, sustituyendo com.vonage.quickstart.users por el paquete que contiene UpdateUser:
Requisitos previos
You will need to use an existing Application and have a User in order to be able to update a User. See the Create Conversation code snippet for information on how to create an Application. See also the Create User code snippet on how to create a User.
Crea un archivo llamado UpdateUser.cs y añade el siguiente código:
Añada lo siguiente a UpdateUser.cs:
Requisitos previos
You will need to use an existing Application and have a User in order to be able to update a User. See the Create Conversation code snippet for information on how to create an Application. See also the Create User code snippet on how to create a User.
Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Pruébalo
Cuando ejecute el código actualizará el nombre y el nombre para mostrar del Usuario especificado.