Skip to content

Files

Latest commit

author
Huan Li
Apr 24, 2019
b93239d · Apr 24, 2019

History

History
238 lines (166 loc) · 9.73 KB

services.user.md

File metadata and controls

238 lines (166 loc) · 9.73 KB

services.user

The User service provides functionality related to Topcoder user accounts.

services.user.default

Default export is User class.

Kind: static property of services.user

services.user.getService(tokenV3, tokenV2) ⇒ Api

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.

services.user~User

Service class.

Kind: inner class of services.user

new User(tokenV3, tokenV2)

Creates a new User service.

Param Type Description
tokenV3 String Topcoder auth tokenV3.
tokenV2 String TC auth token v2.

user.getAchievements(username) ⇒ Object

Gets user achievements. Does not need auth.

Kind: instance method of User

Param Type
username String

user.getUserPublic(username) ⇒ Object

Gets public user info from v2 API. Does not need auth.

Kind: instance method of User

Param Type
username String

user.getUserPublicV3(username) ⇒ Object

Gets public user info from v3 API. Does not need auth.

Kind: instance method of User

Param Type
username String

user.getUser(username) ⇒ Promise

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

user.getEmailPreferences(userId) ⇒ Promise

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

user.saveEmailPreferences(user, preferences) ⇒ Promise

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

user.getCredential(userId) ⇒ Promise

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

user.updatePassword(userId, newPassword, oldPassword) ⇒ Promise

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

user.getLinkedAccounts(userId) ⇒ Promise

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

user.unlinkExternalAccount(userId, provider) ⇒ Promise

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

user.linkExternalAccount(userId, provider, callbackUrl) ⇒ Promise

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

services.user~getSocialUserData(profile, accessToken) ⇒ Object

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