Constructor
# new userActions()
We use this module to access our user related backend API
All the calls here are to the backend of the web-app
Methods
# static answerFriendRequest(fromUser, toUser, accepted)
Parameters:
Name | Type | Description |
---|---|---|
fromUser |
String | id of request sender |
toUser |
String | id of request responder |
accepted |
Boolean | responder accepted or rejected |
# static authenicateFacebook()
Prompts to authenticate with facebook
# static authenicateGoogle()
Prompts to authenticate with google
# static authenicateTwitch()
Prompts to authenticate with twitch
# static checkUsernameExists(regUsername)
Checks if a username exists in the databaase
Parameters:
Name | Type | Description |
---|---|---|
regUsername |
* | username to check for |
true if username exists false otherwise
# static clearNotifications()
Deletes all clearable notifications from current user
# static createNewUser(regUsername, regEmail, regPassword)
Tries to register a custom user with given username , email and password
Parameters:
Name | Type | Description |
---|---|---|
regUsername |
* | userName to register with |
regEmail |
* | email to registerwith |
regPassword |
* | password tor register with |
"auth/user_created" if succesful, otherwise the relevant error (username exists, etc..)
# static deleteNotification(id)
Removes a notification with given id from current user
Parameters:
Name | Type | Description |
---|---|---|
id |
* |
# static getUser()
Returns the up-to-date data of the currently signed in user (or null if no user exist)
# static getUserData(userId)
Returns data regarding a specific requested user by username
Parameters:
Name | Type | Description |
---|---|---|
userId |
* | userId of the user to search for |
# static isUserOnline(userId) → {Boolean}
Parameters:
Name | Type | Description |
---|---|---|
userId |
String | id of user |
true if user online, otherwise false
Boolean
# static pokeYourself()
Temporary test function - sends a notification to your own user
# static searchUsers(searchString, page)
Searches user by a search string (looks at their username and various data) and what page to look in
Results are paginated to pages with 20 entries each
Parameters:
Name | Type | Description |
---|---|---|
searchString |
* | string to search in |
page |
* | what page of the results we are looking for |
# static sendFollowRequest(fromUser, toUser)
Parameters:
Name | Type | Description |
---|---|---|
fromUser |
String | id of follower |
toUser |
String | id of followed user |
# static sendFriendRequest(fromUser, toUser)
Parameters:
Name | Type | Description |
---|---|---|
fromUser |
String | id of request sender |
toUser |
String | id of request receiver |
# static sendUnfollowRequest(fromUser, toUser)
Parameters:
Name | Type | Description |
---|---|---|
fromUser |
String | id of the unfollower |
toUser |
String | id of the unfollowed |
# static setRedirectURL()
Sets the redirect URI for authentication calls to be the current URI
# static signinWithUsernameAndPassword(regUsername, regPassword)
Tries to sign in a user with a given username and password
Parameters:
Name | Type | Description |
---|---|---|
regUsername |
* | username |
regPassword |
* | password |
if failed, a string describing the failure, otherwise the data of the user that signed in
# static signOut()
Logs the current user on the session out
# static unfriendFriendRequest(fromUser, toUser)
Parameters:
Name | Type | Description |
---|---|---|
fromUser |
* | id of unfriending user |
toUser |
* | id of unfriended user |
# static updateUserInterests(userId, data)
Parameters:
Name | Type | Description |
---|---|---|
userId |
String | id of user |
data |
String | list of interests |
# static updateUserShortDescription(userId, data)
Parameters:
Name | Type | Description |
---|---|---|
userId |
* | id of user |
data |
* | new description text |