Class: Teak
Defined in: | src/teak.coffee |
Variables Summary
- Status =
-
{ NotAuthorized: 'Teak user has not authorized application.', NotCreated: 'Teak user does not exist.', Unknown: 'Teak user status unknown.', ReadOnly: 'Teak user has not granted \'publish_actions\' permission.', Authorized: 'Teak user authorized.', Ok: 'Operation successful.', Error: 'Operation unsuccessful.' }
Instance Method Summary
- # (Boolean) init(appId, apiKey, debug = false, w = null) Initialize the Teak SDK.
- # (void) asyncInit(callback) Add a callback to be executed after Teak and Facebook have been initialized.
- # (void) on(event, callback) Add a callback to be executed when a specific event occurs.
- # (void) setUdid(userId, partOfIdentify = false) Set the user's ID without initiating a session.
- # (void) identify(userId, accessToken, callback) Set the user's ID and initiate a session.
- # (void) postAchievement(achievementId, callback) Post an achievement.
- # (void) postHighScore(score, callback) Post a high score for the user.
- # (void) trackEvent(actionId, objectTypeId, objectInstanceId, properties, callback) Track that an arbitrary action occured.
- # (void) postAction(actionId, objectTypeId, objectInstanceId, properties, callback) Post a custom open graph action.
- # (void) canMakeFeedPost(objectInstanceId, callback) Check if a user is allowed to make a given feed post.
-
#
(void)
popupFeedPost(objectInstanceId, objectProperties, callback, postMethod)
Post a feed post (also known as a Stream Publish story)
This call is exclusively used to publish feed posts, either auto publishing through the facebook API or by bringing up the facebook feed dialog.
- # (void) claimReward(rewardId, callback) Attempt to claim a reward
- # (void) sendRequest(templateIdentifier, type, giftId, properties, recipients, callback, postMethod) to use for this request.
- # (void) loadInboxData(callback, updateCallback, fbDataLoader) This will only be executed once for each call made to loadInboxData() player has received since updateCallback was last called.
- # (void) acceptRequest(requestId, callback)
- # (void) deleteRequest(requestId)
- # (void) hasRequestOfOpportunity(opts, callback)
- # (void) sendRequestOfOpportunity(callback)
- # (void) reportAdClick(adId)
Instance Method Details
#
(Boolean)
init(appId, apiKey, debug = false, w = null)
Initialize the Teak SDK.
#
(void)
asyncInit(callback)
Add a callback to be executed after Teak and Facebook have been initialized.
If Teak and Facebook have been initialized when this method is called, the given callback will be executed immediately. Otherwise it will be executed on the later of Teak or Facebook being completely initialized.
All callbacks are guaranteed to be executed after window.fbAsyncInit has been executed.
#
(void)
on(event, callback)
Add a callback to be executed when a specific event occurs. Available events are requestsAvailable -- Triggered when it is now possible for the user to send requests
#
(void)
setUdid(userId, partOfIdentify = false)
Set the user's ID without initiating a session.
This should be used when you are dealing with feed post and request clicks. Call setUdid with the user's known ID, then call acceptRequest() or reportFeedClick() as necessary. This will ensure that Teak properly tracks new users/returning users from requests and clicks. Afterwards identify() must be called to initiate a session.
#
(void)
identify(userId, accessToken, callback)
Set the user's ID and initiate a session.
#
(void)
postAchievement(achievementId, callback)
Post an achievement.
All achievements are defined under the 'earn an achievement' story in your game's OpenGraph settings. This call cannot be used to post any other stories.
#
(void)
postHighScore(score, callback)
Post a high score for the user.
I'm sorry, that's just how Facebook does it...
#
(void)
trackEvent(actionId, objectTypeId, objectInstanceId, properties, callback)
Track that an arbitrary action occured.
We ask that you stay below ~200 unique actionId, objectTypeId and objectInstanceIds though there is no enforced limit.
#
(void)
postAction(actionId, objectTypeId, objectInstanceId, properties, callback)
Post a custom open graph action.
This method is used to post all custom actions, either as explicitly shared, implicitly shared, with a user message, with custom variables, or via the Facebook Share Dialog
#
(void)
canMakeFeedPost(objectInstanceId, callback)
Check if a user is allowed to make a given feed post.
Feed posts may be rate limited to prevent overposting (OpenGraph content is less impacted by overposting). Use this if you want to disable any in game functionality based on if a user will not be share a given post.
#
(void)
popupFeedPost(objectInstanceId, objectProperties, callback, postMethod)
Post a feed post (also known as a Stream Publish story)
This call is exclusively used to publish feed posts, either auto publishing through the facebook API or by bringing up the facebook feed dialog.
Auto published stories are limited by Facebook to 25 per person per day. Dialog stories have no restriction, but users will find them tiring after a couple.
#
(void)
claimReward(rewardId, callback)
Attempt to claim a reward
#
(void)
sendRequest(templateIdentifier, type, giftId, properties, recipients, callback, postMethod)
to use for this request. This controls the message text (possible other stuff TBD) or the staff gate that this request is for. to all recipients. Will receive a list of users who the request was sent to, and a list of recipients that the request could not be sent to
#
(void)
loadInboxData(callback, updateCallback, fbDataLoader)
This will only be executed once for each call made to loadInboxData() player has received since updateCallback was last called. updateCallback will not be called until at least 30 seconds after callback has been called. updateCallback will also include the number of remain gift accepts the user can have, e.g. {"giftLimit": 20}. In the event a day rolls over updateCallback's giftLimit will go up.
#
(void)
acceptRequest(requestId, callback)
#
(void)
deleteRequest(requestId)
#
(void)
hasRequestOfOpportunity(opts, callback)
#
(void)
sendRequestOfOpportunity(callback)
#
(void)
reportAdClick(adId)