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

#import <CPTConnection.h>

Inheritance diagram for <CPTConnection>:
<CPTAuthenticatedConnection>

Instance Methods

(void) - retrieveApplication:
 
(void) - addOrUpdateIntegrationUser:callback:
 
(void) - queryActionsForPlayer:query:callback:
 
(void) - queryLeaderboard:forPlayer:withQuery:callback:
 
(void) - querySocialFeed:callback:
 
(void) - retrieveUser:callback:
 
(nonnull id< CPTAuthenticatedConnection >) - authenticate:
 
(void) - setLanguageCode:
 
(void) - setCountry:
 
(void) - setCurrency:
 
(void) - keepSocketConnected
 
(void) - disconnectSocket
 

Detailed Description

A connection to the Captain Up Platform. An instance of this interface should be instantiated using CaptainUpConnectionFactory#createConnection(String, String, String). Contains method that does not require authentication to be used (aside from the App ID and Mobile Token, that was used to create the connection).

Method Documentation

◆ addOrUpdateIntegrationUser:callback:()

- (void) addOrUpdateIntegrationUser: (nonnull id< CPTIntegrationUser >)  user
callback: (RESPONSE_CALLBACK(id< CPTUserResponse >))  callback 

Allows you to either update an existing user account or create a new user account, based on a unique user ID that you create and maintain in your system. The response will contain the updated user information. thread until the request returns.

Parameters
userthe user details to create or update. The user can be created using the IntegrationUserBuilder
callbacka callback that will contain the response and any exception that might have risen during the execution.

◆ authenticate:()

- (nonnull id<CPTAuthenticatedConnection>) authenticate: (nonnull id< CPTUser >)  user

Returns an authenticated connection to captain up. Some operations are only available after authentication.

Parameters
userthe user to authenticate. This user can be acquired from the addOrUpdateIntegrationUser.
Returns
an authenticated connection to captain up.
See also
#addOrUpdateIntegrationUser(IntegrationUser)
#addOrUpdateIntegrationUserAsync(IntegrationUser, ResponseCallback)

◆ disconnectSocket()

- (void) disconnectSocket

Call this method to disconnect socket.

◆ keepSocketConnected()

- (void) keepSocketConnected

Call this method to keep socket connected. Main use would be connect immidialty whne applicaion becomes acrive

◆ queryActionsForPlayer:query:callback:()

- (void) queryActionsForPlayer: (nonnull NSString *)  playerId
query: (nonnull id< CPTQuery >)  query
callback: (RESPONSE_CALLBACK(id< CPTSocialFeedResponse >))  callback 

Returns several actions and information about the users associated with them. Only returns public actions, since there is no authenticated user. Use this method to request the public actions of any user in your application. thread until the request returns.

Parameters
playerIdthe ID of the player whose actions are requested
queryquery parameters. To create a query object use QueryBuilder
callbacka callback that will contain the response and any exception that might have risen during the execution.

◆ queryLeaderboard:forPlayer:withQuery:callback:()

- (void) queryLeaderboard: (CPTLeaderboardTime)  time
forPlayer: (nullable NSString *)  playerId
withQuery: (nonnull id< CPTQuery >)  query
callback: (RESPONSE_CALLBACK(id< CPTLeaderboardResponse >))  callback 

Returns several users from the requested leaderboard, including general information on t hose users, and their position in the leaderboard.

Parameters
timethe type of the leaderboard (according to the time limit on the leaderboard)
playerIdthe user id for the user we want to focus the leaderboard on. Useful for showing a specific user’s standing in the leaderboard. If playerId is not null, the skip query parameter will be dismissed. The response will be a list of the players around the given player, with a maximum of half the users above the player and the rest below.
queryquery parameters. To create a query object use QueryBuilder.
  • skip - The number of users to skip when returning the users. If skip is above the total number of users, an empty list of users will be returned.
  • limit - The maximum number of users to return in the results. Can be between 10 and 100.
  • extended - If set to true, will return extended information on each user.
Returns
a response object that may either contain an error code or the leaderboard's details

◆ querySocialFeed:callback:()

- (void) querySocialFeed: (nonnull id< CPTQuery >)  query
callback: (RESPONSE_CALLBACK(id< CPTSocialFeedResponse >))  callback 

Returns several actions and information about the users associated with them. Only returns public actions, since there is no authenticated user. Use this method to request the public actions of any user in your application. This method is preferred over queryActions since this will not block the current thread until the request returns.

Parameters
queryquery parameters. To create a query object use QueryBuilder
callbacka callback that will contain the response and any exception that might have risen during the execution.

◆ retrieveApplication:()

- (void) retrieveApplication: (RESPONSE_CALLBACK(id< CPTApplicationResponse >))  callback

Returns all the current connected application's settings, including information on the action settings, levels, badges and etc. current thread until the request returns.

Parameters
callbacka callback that will contain the response and any exception that might have risen during the execution.

◆ retrieveUser:callback:()

- (void) retrieveUser: (nonnull NSString *)  userId
callback: (RESPONSE_CALLBACK(id< CPTUserResponse >))  callback 

Returns information about the specific user requested, including general information about the user (name, Facebook link, avatar, etc.) and information about the user's progress (current level, number of points, missions and progress).

Parameters
userIdthe user's captain-up ID
callbackcallback that will contain the response and any exception that might have risen during the execution.
See also
#retrieveUser(String)

◆ setCountry:()

- (void) setCountry: (nonnull NSString *)  country

Use this function for setting your user country, setting country will affect your application currency conversion ratio. this function must be called *before calling

See also
authenticate(User user) or connect.

This function is used internally by CaptainUpManager object

Parameters
countrycountry code string

◆ setCurrency:()

- (void) setCurrency: (nonnull NSString *)  currency

Use this function for setting your user currency, setting currency will affect your application currency conversion ratio. this function must be called *before calling

See also
authenticate(User user) or connect.

This function is used internally by CaptainUpManager object

Parameters
currencycurrency string

◆ setLanguageCode:()

- (void) setLanguageCode: (nonnull NSString *)  languageCode

Use this function for setting your user localization, setting language code will affect your application badges and levels as localized in the admins panel. this function must be called *before calling

See also
authenticate(User user) or connect.

This function is used internally by CaptainUpManager object

Parameters
languageCodelanguage code

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