Captainup  2.4
Instance Methods | Properties | List of all members
<CPTActionableUser> Protocol Reference

#import <CPTActionableUser.h>

Inheritance diagram for <CPTActionableUser>:
<CPTUser> <CPTObject>

Instance Methods

(void) - addListener:
 
(void) - removeListener:
 
(void) - performAction:
 
(nonnull NSDictionary< id< CPTBadge >, id< CPTReward >> *) - getUnclaimedRewards
 Returns a list of rewards that are ready to be claimed (unclaimed rewards from achieved badges). You can present these reward to the user with a 'claim' button, when user pressed 'claim' you can use claimReward to claim. More...
 
(nonnull NSArray< id< CPTReward >> *) - getUnclaimedRewards:
 Giving a Badge object, returns a list of associated rewards that are ready to be claimed. Can be used when achieving a badge to get all the badge's associated rewards. More...
 
(BOOL) - isRewardClaimable:
 
(void) - claimReward:
 Performs a claim action on a badge with reward. More...
 
(void) - claimReward:withCallback:
 Performs an Async claim action on a badge with reward, accepts a callback. More...
 
(void) - claimReward:andReward:
 Performs a claim action on a badge with reward. More...
 
(void) - claimReward:andReward:withCallback:
 Perform an Async claim action on a specific reward, accepts callback. More...
 
(nonnull id< CPTCreateAcquireResponse >) - acquireAsset:
 
(void) - acquireAssetAsync:withCallback:
 
(void) - updateName:
 
(void) - updateName:withCallback:
 
(void) - updateImageUrl:
 
(void) - updateImageUrl:withCallback:
 
- Instance Methods inherited from <CPTUser>
(nullable id< CPTLevel >) - getLevel
 
(nullable id< CPTLevel >) - getNextLevel
 
(void) - setApplication:
 
(nonnull NSArray< NSString * > *) - getUnavailableSegmentedBadgesIDs
 
(nonnull NSArray< NSString * > *) - getUnavailableSegmentedAssetIDs
 
(nonnull NSArray< id< CPTAction >> *) - getBaseUnreadInboxItems
 
- Instance Methods inherited from <CPTObject>
(nonnull instancetype) - initWithDictionary:
 
(nonnull NSDictionary< NSString *, id > *) - toDictionary
 

Properties

id< CPTInboxinbox
 
id< CPTNotificationsQueuenotificationsQueue
 
- Properties inherited from <CPTUser>
NSString * userId
 
NSString * clientUserID
 
NSString * accessToken
 
NSString * name
 
NSString * imageURL
 
CPTPoint monthlyPoints
 
CPTPoint weeklyPoints
 
CPTPoint dailyPoints
 
NSDictionary< NSString *, NSNumber * > * leaderboardPositions
 
NSArray< id< CPTAction > > * privateActivities
 
NSArray< id< CPTAction > > * publicActivities
 
CPTBadgeProgressDictionarybadgeProgress
 
NSUInteger totalActionCount
 
NSDictionary< NSString *, NSNumber * > * actionCounters
 
NSString * levelID
 
NSDictionary< NSString *, NSNumber * > * currencies
 
NSArray< id< CPTAcquiredAsset > > * acquiredAssets
 
NSArray< id< CPTAvailableReward > > * availableRewards
 
- Properties inherited from <CPTObject>
NSDictionary< NSString *, id > * sourceDictionary
 

Detailed Description

Description

Method Documentation

◆ acquireAsset:()

- (nonnull id<CPTCreateAcquireResponse>) acquireAsset: (nonnull id< CPTAsset >)  asset

Acquire an asset, you will receive the Asset object in the CPTUserListener listener. in some cases (for example when user does not have enough currency or stock is limited) call will return an error, you can listen to error events to catch that error, or supply a callback. This method is asynchronous.

Parameters
assetThe id<CPTAsset> to acquire
Returns
CPTCreateAcquireResponse

◆ acquireAssetAsync:withCallback:()

- (void) acquireAssetAsync: (nonnull id< CPTAsset >)  asset
withCallback: (RESPONSE_CALLBACK(id< CPTCreateAcquireResponse >))  callback 

Acquire an asset, you will receive the Asset object in the CPTUserListener listener. in some cases (for example when user does not have enough currency or stock is limited) call will return an error. This method is asynchronous.

Parameters
assetid<CPTAsset> to acquire
callbackCPTCreateAcquireResponse

◆ addListener:()

- (void) addListener: (nonnull id< CPTUserListener >)  listener

Adds a listener to this user instance. The type of event of events being listened to is determined by the exact protocols implemented by the listener parameter.

Parameters
listenerlistener CPTUserListener

◆ claimReward:()

- (void) claimReward: (nonnull id< CPTBadge >)  badge

Performs a claim action on a badge with reward.

Parameters
badgeCPTBadge with reward

◆ claimReward:andReward:()

- (void) claimReward: (nonnull id< CPTBadge >)  badge
andReward: (nonnull id< CPTReward >)  reward 

Performs a claim action on a badge with reward.

Parameters
badgeCPTBadge with reward
rewardCPTReward The reward to claim

◆ claimReward:andReward:withCallback:()

- (void) claimReward: (nonnull id< CPTBadge >)  badge
andReward: (nonnull id< CPTReward >)  reward
withCallback: (RESPONSE_CALLBACK(id< CPTClaimResponse >))  callback 

Perform an Async claim action on a specific reward, accepts callback.

Parameters
badgeCPTBadge with the reward
rewardCPTReward The reward to claim
callbackvoid(^)(id<CPTClaimResponse> response, NSError *error) with reward

◆ claimReward:withCallback:()

- (void) claimReward: (nonnull id< CPTBadge >)  badge
withCallback: (RESPONSE_CALLBACK(id< CPTClaimResponse >))  callback 

Performs an Async claim action on a badge with reward, accepts a callback.

Parameters
badgeCPTBadge with reward
callbackvoid(^)(id<CPTClaimResponse> response, NSError *error) with reward

◆ getUnclaimedRewards()

- (nonnull NSDictionary<id<CPTBadge>,id<CPTReward>>*) getUnclaimedRewards

Returns a list of rewards that are ready to be claimed (unclaimed rewards from achieved badges). You can present these reward to the user with a 'claim' button, when user pressed 'claim' you can use claimReward to claim.

Returns
NSDictionary map of all reward that the user can claim (where key is the badge object and value is the associated reward), or an empty Map in case no rewards are available.

◆ getUnclaimedRewards:()

- (nonnull NSArray<id<CPTReward>>*) getUnclaimedRewards: (nonnull id< CPTBadge >)  badge

Giving a Badge object, returns a list of associated rewards that are ready to be claimed. Can be used when achieving a badge to get all the badge's associated rewards.

Parameters
badgeCPTBadge to check rewards in. (Must be an achieved badge)
Returns
NSArray list of badge rewards or an empty list if no rewards are available.

◆ isRewardClaimable:()

- (BOOL) isRewardClaimable: (nonnull id< CPTBadge >)  badge

Checks if the badge's reward is available to claim for the current user.

Returns
true if badge contains a reward, badge was achieved and reward was never claimed, or (in case of repeatable badges with rewards), if badge was achieved more times than reward was claimed, otherwise returns false.

◆ performAction:()

- (void) performAction: (nonnull id< CPTAction >)  action

Perform action

Parameters
actionaction CPTAction

◆ removeListener:()

- (void) removeListener: (nonnull id< CPTUserListener >)  listener

Remove listner

Parameters
listenerlistener CPTUserListener

◆ updateImageUrl:()

- (void) updateImageUrl: (nonnull NSString *)  url

Update user Image url

Parameters
urluser profile pic url

◆ updateImageUrl:withCallback:()

- (void) updateImageUrl: (nonnull NSString *)  url
withCallback: (RESPONSE_CALLBACK(id< CPTUserResponse >))  callback 

Update user Image url

Parameters
urluser profile url
callbackuser prfoile url updated callback

◆ updateName:()

- (void) updateName: (nonnull NSString *)  name

Update user name

Parameters
namenew name of user

◆ updateName:withCallback:()

- (void) updateName: (nonnull NSString *)  name
withCallback: (RESPONSE_CALLBACK(id< CPTUserResponse >))  callback 

Update user name

Parameters
nameuser name
callbackuser details updated callback

Property Documentation

◆ inbox

- (id<CPTInbox>) inbox
readnonatomicassign

Inbox

◆ notificationsQueue

- (id<CPTNotificationsQueue>) notificationsQueue
readnonatomicassign

Notification queue


The documentation for this protocol was generated from the following file: