User Class
Internal class for manging Sinch Users
Constructor
User
-
sinch
Parameters:
-
sinch
SinchClientA reference to a SinchClient object this object belongs to.
Item Index
Methods
authenticate
-
loginObj
Internal method to authenticate and store user data in the user object
Parameters:
-
loginObj
ObjectObject containing a userObject with auth ticket, or a loginObj specifying password and one of username, number or email.
-
[email]
String optionalAuthenticate using email
-
[number]
String optionalAuthenticate using number
-
[username]
String optionalAuthenticate using username
-
[password]
String optionalThe password to authenticate using
-
[expiresIn]
String optionalThe desired TTL of a session, in seconds. Default is 24 hours.
-
Returns:
promise which resolves null on success
create
-
signupObj
Internal method to create a new user, retrieves authentication ticket.
Parameters:
-
signupObj
ObjectObject with details on the user. One or more of email/username/number must be specifieed.
-
[email]
String optionalE-mail identity
-
[username]
String optionalusername identity
-
[number]
String optionalnumber identity
-
Returns:
promise which resolves to an object containing the user and authorization ticket
getMXPConf
()
protected
chainable
async
Internal method to retrieve MXP user configuration from PAPI. Configuration is store it in "this"
Returns:
promise which resolves null on success
initSessKeySecret
()
protected
chainable
async
Internal method to retrieve instance (key & secret for signed requests), key and secret stored in {SinchClient} object. (Previously sessions where used, hence the name. TODO: Rename function to something with instances)
Returns:
promise which resolves null on success
resumeSession
()
protected
chainable
async
Internal method to resume a session.
Returns:
promise which resolves null on success
updateUser
()
protected
chainable
async
Internal method to update user profile
Returns:
promise which resolves to the new user object on success
Example:
sinchClient.user.updateUser({name: {first: 'First name', last: 'Some last name'}})
.then(function(newUserObj) {
//Do things with the new user object
});
Properties
userObj
Object
protected
User object with some fundamental information and the user profile. Contents may vary.