Playbasis Player API
Methods
-
<static> actionCount(playerId, actionName)
-
Returns the number of times that a player has performed the specified action.
Parameters:
Name Type Description playerIdString player id
actionNameString name of the action to query
Returns:
Promise Object
- Type
- Object
-
<static> actionTime(playerId, actionName)
-
Return the last time that player has performed the specified action.
Parameters:
Name Type Description playerIdString player id
actionNameString name of action to query
Returns:
Promise Object
- Type
- Object
-
<static> allBadges(playerId, options)
-
Return information about all the badges of the client as well as the amount that a player may earn.
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as object.
It can include.
{tags: String = specific tags to find, each tag delimited by comma i.e. foo,bar
}Returns:
Promise Object
- Type
- Object
-
<static> allQuestsOfPlayer(playerId)
-
Return list of all available quests of the client as well as the status of the player if joined.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> badge(playerId, options)
-
Return information about all the badges that a player has earned.
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as object.
It can include
{
tags: String = specific tags to find, each tag delimited by comma i.e. foo,bar
}Returns:
Promise Object
- Type
- Object
-
<static> deductBadge(playerId, badge, amount, options)
-
Deduct a badge from a given player.
Parameters:
Name Type Description playerIdString player id
badgeString name of badge to deduct
amountNumber amount to deduct
optionsObject (optional) options as Object.
It can include
{
force: Number = 0 for not force if player has not enough badge to deduct | 1 = force to do the deduct (and player's badge becomes zero)
}Returns:
Promise Object
- Type
- Object
-
<static> deductReward(playerId, reward, amount, options)
-
Deduct a reward from player
Parameters:
Name Type Description playerIdString player id
rewardString reward name to deduct from player
amountNumber amount of reward to deduct
optionsObject (optional) options as Object.
It can include
{
force: Number = 0 for not force if player has not enough reward to deduct | 1 = force to do the deduct (and player's reward becomes zero)
}.Returns:
Promise Object
- Type
- Object
-
<static> delete(playerId)
-
Permanently delete player from Playbasis database.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> favoriteGoods(playerId, goodsId, status)
-
Set specific goods in player's inventory as favorite
Parameters:
Name Type Description playerIdString player id
goodsIdString goods id to set favorite status
statusBoolean status to set. It can be either
trueorfalseReturns:
Promise object
- Type
- Object
-
<static> findPlayerBySession(sessionId)
-
Find a player by given session id.
Parameters:
Name Type Description sessionIdString session id
Returns:
Promise Object
- Type
- Object
-
<static> giveGift(sentPlayerId, receivedPlayerId, giftId, type, amount)
-
Give gift item from player to player.
Parameters:
Name Type Description sentPlayerIdString player id that send the gift
receivedPlayerIdString player id that received the gift
giftIdString gift id can be badge id, goods id , custom point id
typeString type of gift, the value can be "badge" | "custom_point" | "goods"
amountNumber amount of gift to be sent to received player
Returns:
Promise Object
- Type
- Object
-
<static> goods(playerId, options)
-
Returns information about all the goods list that a player has redeem.
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as Object.
It can include
{
tags: String = tag to query separated by comma,
status: String = "all" | "active" | "expired" | "used". Default is "active".
}. -
<static> goodsCount(playerId, options)
-
Returns information about number of goods that player has
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as Object.
It can include
{
tags: String = goods tag to query separated by comma,
status: String = "all" | "active" | "expired" | "used". Default is "active".
}.Returns:
Promise object
- Type
- Object
-
<static> lastAction(playerId)
-
Return the time and action that a player last performed.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> level(level)
-
Return detail of level
Parameters:
Name Type Description levelNumber numbe of level
Returns:
Promise Object
- Type
- Object
-
<static> levels()
-
Return all detail of level.
Returns:
Promise Object
- Type
- Object
-
<static> listActivePlayerSessions(playerId)
-
List active sessions of a player in Playbasis system.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> listCustomFieldsOfPlayer(playerId)
-
Get custom fields information about a player.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> listPlayer(playerIdArray)
-
Get basic information of players
Parameters:
Name Type Description playerIdArrayString array of player id String
Returns:
Promise Object
- Type
- Object
-
<static> login(playerId)
-
Tell Playbasis system that a player has logged in.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> logout(playerId)
-
Tell Playbasis system that a player has logged out.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> performOTPVerification(playerId, OTPcode)
-
Perform OTP verification from code that has sent to player SMS.
Parameters:
Name Type Description playerIdStirng player id
OTPcodeString OTP code as sent to player
Returns:
Promise Object
- Type
- Object
-
<static> playerDetailedInfo(playerId)
-
Get detailed public and private information about player, including points and badges.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> playerDetailedPublicInfo(playerId)
-
Get detailed public information about player, including points and badges.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> playerInfo(playerId)
-
Get public and private information about a player.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> playerPublicInfo(playerId)
-
Get public information about player.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> playerReferralCode(playerId)
-
Return generated referral code of player.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> point(playerId, pointName)
-
Returns how much of specified the point-based reward a player currently has.
Parameters:
Name Type Description playerIdString player id
pointNameString name of point-based reward to query
Returns:
Promise Object
- Type
- Object
-
<static> pointHistory(playerId, options)
-
Returns history points of player
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as Object.
It can include
{
point_name: String = "point" | "exp" | ...,
offset: Number = offset of returned records,
limit: Number = number of returned records to return,
order: String = "desc" | "asc"
}Returns:
Promise Object
- Type
- Object
-
<static> points(playerId)
-
Return information about all point-based rewards that a player currently has.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> questListOfPlayer(playerId, options)
-
Return list of quests that player has joined.
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as Object.
It can include
{
tags: String = tag to query separated by comma
}. -
<static> questOfPlayer(playerId, questId)
-
Return information about the specified quest that player has joined.
Parameters:
Name Type Description playerIdString player id
questIdString quest id that playered has joined, to get information from
-
<static> questRewardHistory(playerId, options)
-
Return quest reward history of player.
Parameters:
Name Type Description playerIdString player id
optionsObject (optional) options as Object.
It can include
{
offset: Number,
limit: Number
}Returns:
Promise Object
- Type
- Object
-
<static> rank(rankBy, limit, options)
-
Return the list of players sorted by the specified point type.
Parameters:
Name Type Description rankByString point-based name to rank by ("exp" | "point", etc)
limitNumber amount of items to return
optionsObject (optional) options as Object. It can include
{
mode: String = "all-time" | "weekly" | "monthly"
}.Returns:
Promise Object
- Type
- Object
-
<static> ranks(limit, options)
-
Return list of players sorted by each point type.
Parameters:
Name Type Description limitNumber limit number of players returned in the list
optionsObject (optional) option as Object. It can include
{
mode: String = "all-time" | "weekly" | "monthly"
}. -
<static> referral(playerId, referralCode, options)
-
Referral player
Parameters:
Name Type Description playerIdString player id
referralCodeString referral code of another player for invitation system
optionsString (optional) option as Object. It can include {
key: String = It can be any key and value, }Returns:
Promise Object
- Type
- Object
-
<static> register(playerId, email, options)
-
Register player
Parameters:
Name Type Description playerIdString player id
emailString email to register player with
optionsString (optional) option as Object.
It can include
{
image: String = url to the player profile image,
phone_number: String = phone number in format +66xxyyyzzzz,
facebook_id: String = facebook id of player,
twitter_id: String = twitter id of player,
password: String = password,
first_name: String = first name of player,
last_name: *String = last name of player,
gender: *Number = 1 for Male | 2 for Female,
birth_date: String = date of birth in the format YYYY-MM-DD (ex. 1982-09-29),
code: String = referral code of another player for invitation system,
anonymous: Number = 0 | 1,
device_id: String = device id to verify with SMS verification process,
approve_status: String = "approved" | "rejected" | "pending",
}Returns:
Promise Object
- Type
- Object
-
<static> requestOTP(playerId)
-
Request one time password.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object
-
<static> requestOTPforSetupPhone(playerId, phoneNumber)
-
Request one time password for setup phone.
Parameters:
Name Type Description playerIdString player id
phoneNumberString phone number in format +66xxyyyzzzz
Returns:
Promise Object
- Type
- Object
-
<static> resetPlayerPassword(email)
-
Reset player password that store in Playbasis system.
Parameters:
Name Type Description emailString email of player
Returns:
Promise Object
- Type
- Object
-
<static> setCustomFieldOfPlayer(playerId, key, value)
-
Set custom field of player
Parameters:
Name Type Description playerIdString player id
keyString key of custom field
valueString value of custom field
-
<static> update(playerId, updates)
-
Update player information
Parameters:
Name Type Description playerIdString player id
updatesObject update values as Object.
It can include
{
username: String = username,
email: String = email,
image: String = image url of player,
phone_number: String = phone number in format +66xxyyzzz,
exp: Number = experience point,
level: Number = level,
facebook_id: String = facebook id of player,
twitter_id: String = twitter id of player,
password: String = password of player,
first_name: String = first name of player,
last_name: String = last name of player,
gender: Number = 1 for Male | 2 for Female,
birth_date: String = birth date in format YYYY-MM-DD (ex. 1982-09-29),
device_id: String = device id to verfiy with SMS verification process,
approve_status: String = "approved" | "rejected" | "pending"
}Returns:
Promise Object
- Type
- Object
-
<static> verifyPlayerEmail(playerId)
-
Verify player email that store in Playbasis system by sending verification email.
Parameters:
Name Type Description playerIdString player id
Returns:
Promise Object
- Type
- Object