The User service provides functionality related to Topcoder user accounts.
- services.user
- static
- inner
- ~User
- new User(tokenV3, tokenV2)
- .getAchievements(username) ⇒
Object
- .getUserPublic(username) ⇒
Object
- .getUserPublicV3(username) ⇒
Object
- .getUser(username) ⇒
Promise
- .getEmailPreferences(userId) ⇒
Promise
- .saveEmailPreferences(user, preferences) ⇒
Promise
- .getCredential(userId) ⇒
Promise
- .updatePassword(userId, newPassword, oldPassword) ⇒
Promise
- .getLinkedAccounts(userId) ⇒
Promise
- .unlinkExternalAccount(userId, provider) ⇒
Promise
- .linkExternalAccount(userId, provider, callbackUrl) ⇒
Promise
- ~getSocialUserData(profile, accessToken) ⇒
Object
- ~User
Default export is User class.
Kind: static property of services.user
Returns a new or existing User service for the specified tokenV3.
Kind: static method of services.user
Returns: Api
- API v3 service object.
Param | Type | Description |
---|---|---|
tokenV3 | String |
Optional. Topcoder auth token v3. |
tokenV2 | String |
Optional. TC auth token v2. |
Service class.
Kind: inner class of services.user
- ~User
- new User(tokenV3, tokenV2)
- .getAchievements(username) ⇒
Object
- .getUserPublic(username) ⇒
Object
- .getUserPublicV3(username) ⇒
Object
- .getUser(username) ⇒
Promise
- .getEmailPreferences(userId) ⇒
Promise
- .saveEmailPreferences(user, preferences) ⇒
Promise
- .getCredential(userId) ⇒
Promise
- .updatePassword(userId, newPassword, oldPassword) ⇒
Promise
- .getLinkedAccounts(userId) ⇒
Promise
- .unlinkExternalAccount(userId, provider) ⇒
Promise
- .linkExternalAccount(userId, provider, callbackUrl) ⇒
Promise
Creates a new User service.
Param | Type | Description |
---|---|---|
tokenV3 | String |
Topcoder auth tokenV3. |
tokenV2 | String |
TC auth token v2. |
Gets user achievements. Does not need auth.
Kind: instance method of User
Param | Type |
---|---|
username | String |
Gets public user info from v2 API. Does not need auth.
Kind: instance method of User
Param | Type |
---|---|
username | String |
Gets public user info from v3 API. Does not need auth.
Kind: instance method of User
Param | Type |
---|---|
username | String |
Gets user data object for the specified username.
NOTE: Only admins are authorized to use the underlying endpoint.
Kind: instance method of User
Returns: Promise
- Resolves to the user data object.
Param | Type |
---|---|
username | String |
Gets email preferences.
NOTE: Only admins are authorized to use the underlying endpoint.
Kind: instance method of User
Returns: Promise
- Resolves to the email preferences result
Param | Type | Description |
---|---|---|
userId | Number |
The TopCoder user id |
Saves email preferences.
NOTE: Only admins are authorized to use the underlying endpoint.
Kind: instance method of User
Returns: Promise
- Resolves to the email preferences result
Param | Type | Description |
---|---|---|
user | Object |
The TopCoder user |
preferences | Object |
The email preferences |
Gets credential for the specified user id.
NOTE: Only admins are authorized to use the underlying endpoint.
Kind: instance method of User
Returns: Promise
- Resolves to the linked accounts array.
Param | Type | Description |
---|---|---|
userId | Number |
The user id |
Updates user password.
NOTE: Only admins are authorized to use the underlying endpoint.
Kind: instance method of User
Returns: Promise
- Resolves to the update result.
Param | Type | Description |
---|---|---|
userId | Number |
The user id |
newPassword | String |
The new password |
oldPassword | String |
The old password |
Gets linked accounts for the specified user id.
NOTE: Only admins are authorized to use the underlying endpoint.
Kind: instance method of User
Returns: Promise
- Resolves to the linked accounts array.
Param | Type | Description |
---|---|---|
userId | Number |
The user id |
Unlinks external account.
Kind: instance method of User
Returns: Promise
- Resolves to the unlink result
Param | Type | Description |
---|---|---|
userId | Number |
The TopCoder user id |
provider | String |
The external account service provider |
Links external account.
Kind: instance method of User
Returns: Promise
- Resolves to the linked account result
Param | Type | Description |
---|---|---|
userId | Number |
The TopCoder user id |
provider | String |
The external account service provider |
callbackUrl | String |
Optional. The callback url |
Gets social user data.
Kind: inner method of services.user
Returns: Object
- Social user data
Param | Type | Description |
---|---|---|
profile | Object |
The user social profile |
accessToken | * |
The access token |