Skip to content

Commit

Permalink
Merge pull request #286 from getbraincloud/release/5.4.0
Browse files Browse the repository at this point in the history
Release/5.4.0
  • Loading branch information
bitheadCody authored Aug 30, 2024
2 parents f085838 + 2156c46 commit 0f03923
Show file tree
Hide file tree
Showing 19 changed files with 592 additions and 15 deletions.
2 changes: 1 addition & 1 deletion BrainCloudCpp.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pod::Spec.new do |s|

s.name = "BrainCloudCpp"

s.version = "5.3.0"
s.version = "5.4.0"

s.summary = "The C++ client library for brainCloud"
s.homepage = "http://getbraincloud.com/"
Expand Down
13 changes: 13 additions & 0 deletions include/braincloud/BrainCloudEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ namespace BrainCloud
*/
void updateIncomingEventData(const char * in_evId, const std::string& in_jsonEventData, IServerCallback * in_callback = NULL);

/**
* Updates an event in the user's incoming event mailbox.
* Returns the same data as updateIncomingEventData, but returns null instead of an error if none exists.
*
* Service Name - event
* Service Operation - UPDATE_EVENT_DATA
*
* @param in_evId The event id
* @param in_jsonEventData The user-defined data for this event encoded in JSON.
* @param in_callback The method to be invoked when the server response is received
*/
void updateIncomingEventDataIfExists(const char * in_evId, const std::string& in_jsonEventData, IServerCallback * in_callback = NULL);

/**
* Delete an event out of the user's incoming mailbox.
*
Expand Down
2 changes: 1 addition & 1 deletion include/braincloud/BrainCloudLobby.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ namespace BrainCloud
/// <summary>
/// Cancel this members Find, Join and Searching of Lobbies
/// </summary>
void cancelFindRequest(const std::string& in_lobbyType, const std::string& in_cxId, IServerCallback* in_callback);
void cancelFindRequest(const std::string& in_lobbyType, IServerCallback* in_callback);

/* Runs ping callbacks if pingRegions was called.
* Note: This is already called by BrainCloudClient::runCallbacks
Expand Down
208 changes: 206 additions & 2 deletions include/braincloud/BrainCloudSocialLeaderboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@ namespace BrainCloud
*/
void getSocialLeaderboard(const char * in_leaderboardId, bool in_replaceName, IServerCallback * in_callback = NULL);

/**
* Method returns the social leaderboard. A player's social leaderboard is
* comprised of players who are recognized as being your friend.
*
* This method returns the same data as getSocialLeaderboard, but it will not return an error if the leaderboard is not found.
*
* The method will retrieve all friends from all friend platforms, so
* - all external friends (Facebook, Steam, PlaystationNetwork)
* - all internal friends (brainCloud)
* - plus "self".
*
* Leaderboards entries contain the player's score and optionally, some user-defined
* data associated with the score. The currently logged in player will also
* be returned in the social leaderboard.
*
* Note: If no friends have played the game, the bestScore, createdAt, updatedAt
* will contain NULL.
*
* @param in_leaderboardId The id of the leaderboard to retrieve
* @param in_replaceName If true, the currently logged in player's name will be replaced
* by the string "You".
* @param in_callback The method to be invoked when the server response is received
*
*/
void getSocialLeaderboardIfExists(const char *in_leaderboardId, bool in_replaceName, IServerCallback *in_callback = NULL);

/**
* Method returns the social leaderboard by its version. A player's social leaderboard is
* comprised of players who are recognized as being your friend.
Expand All @@ -94,6 +120,33 @@ namespace BrainCloud
*/
void getSocialLeaderboardByVersion(const char * in_leaderboardId, bool in_replaceName, int in_versionId, IServerCallback * in_callback = NULL);

/**
* Method returns the social leaderboard by its version. A player's social leaderboard is
* comprised of players who are recognized as being your friend.
*
* This method returns the same data as getSocialLeaderboardByVersion, but it will not return an error if the leaderboard is not found.
*
* The method will retrieve all friends from all friend platforms, so
* - all external friends (Facebook, Steam, PlaystationNetwork)
* - all internal friends (brainCloud)
* - plus "self".
*
* Leaderboards entries contain the player's score and optionally, some user-defined
* data associated with the score. The currently logged in player will also
* be returned in the social leaderboard.
*
* Note: If no friends have played the game, the bestScore, createdAt, updatedAt
* will contain NULL.
*
* @param in_leaderboardId The id of the leaderboard to retrieve
* @param in_replaceName If true, the currently logged in player's name will be replaced
* by the string "You".
* @param in_versionId the version of the leaderboard
* @param in_callback The method to be invoked when the server response is received
*
*/
void getSocialLeaderboardByVersionIfExists(const char *in_leaderboardId, bool in_replaceName, int in_versionId, IServerCallback *in_callback = NULL);

/**
* Reads multiple social leaderboards.
*
Expand Down Expand Up @@ -131,14 +184,38 @@ namespace BrainCloud
int in_endIndex,
IServerCallback * in_callback = NULL);

/**
* Method returns a page of global leaderboard results.
* Returns the same data as getGlobalLeaderboardPage, but does not return an error if the leaderboard does not exist.
*
* Leaderboards entries contain the player's score and optionally, some user-defined
* data associated with the score.
*
* Note: This method allows the client to retrieve pages from within the global leaderboard list
*
* Service Name - SocialLeaderboard
* Service Operation - GET_GLOBAL_LEADERBOARD_PAGE_IF_EXISTS
*
* @param in_leaderboardId The id of the leaderboard to retrieve.
* @param in_sort Sort key Sort order of page.
* @param in_startIndex The index at which to start the page.
* @param in_endIndex The index at which to end the page.
* @param in_callback The method to be invoked when the server response is received
*/
void getGlobalLeaderboardPageIfExists(
const char *in_leaderboardId,
SortOrder in_sortOrder,
int in_startIndex,
int in_endIndex,
IServerCallback *in_callback = NULL);

/**
* Method returns a page of global leaderboard results.
* By using a non-current version id, the user can retrieve a historical leaderboard.
* See GetGlobalLeaderboardVersions method to retrieve the version id.
*
* Service Name - SocialLeaderboard
* Service Operation - GetGlobalLeaderboardPage
* Service Operation - GET_GLOBAL_LEADERBOARD_PAGE_BY_VERSION
*
* @param in_leaderboardId The id of the leaderboard to retrieve.
* @param in_sort Sort key Sort order of page.
Expand All @@ -155,7 +232,31 @@ namespace BrainCloud
int in_versionId,
IServerCallback * in_callback = NULL);


/**
* Method returns a page of global leaderboard results.
* By using a non-current version id, the user can retrieve a historical leaderboard.
* See GetGlobalLeaderboardVersions method to retrieve the version id.
*
* This method returns the same data as getGlobalLeaderboardPageByVersion, but it will not return an error if the leaderboard does not exist
*
* Service Name - SocialLeaderboard
* Service Operation - GET_GLOBAL_LEADERBOARD_PAGE_BY_VERSION_IF_EXISTS
*
* @param in_leaderboardId The id of the leaderboard to retrieve.
* @param in_sort Sort key Sort order of page.
* @param in_startIndex The index at which to start the page.
* @param in_endIndex The index at which to end the page.
* @param in_versionId The historical version to retrieve.
* @param in_callback The method to be invoked when the server response is received
*/
void getGlobalLeaderboardPageByVersionIfExists(
const char *in_leaderboardId,
SortOrder in_sortOrder,
int in_startIndex,
int in_endIndex,
int in_versionId,
IServerCallback *in_callback = NULL);

/**
* Method returns a view of global leaderboard results that centers on the current player.
*
Expand All @@ -173,6 +274,24 @@ namespace BrainCloud
*/
void getGlobalLeaderboardView(const char * in_leaderboardId, SortOrder in_sortOrder, int in_beforeCount, int in_afterCount, IServerCallback * in_callback = NULL);

/**
* Method returns a view of global leaderboard results that centers on the current player.
* Returns the same data as getGlobalLeaderboardView, but will not return an error if the leaderboard does not exist.
*
* Leaderboards entries contain the player's score and optionally, some user-defined
* data associated with the score.
*
* Service Name - SocialLeaderboard
* Service Operation - GET_GLOBAL_LEADERBOARD_VIEW_IF_EXISTS
*
* @param in_leaderboardId The id of the leaderboard to retrieve.
* @param in_sort Sort key Sort order of page.
* @param in_beforeCount The count of number of players before the current player to include.
* @param in_afterCount The count of number of players after the current player to include.
* @param in_callback The method to be invoked when the server response is received
*/
void getGlobalLeaderboardViewIfExists(const char * in_leaderboardId, SortOrder in_sortOrder, int in_beforeCount, int in_afterCount, IServerCallback * in_callback = NULL);

/**
* Method returns a view of global leaderboard results that centers on the current player.
* By using a non-current version id, the user can retrieve a historical leaderboard.
Expand All @@ -190,6 +309,25 @@ namespace BrainCloud
*/
void getGlobalLeaderboardViewByVersion(const char * in_leaderboardId, SortOrder in_sortOrder, int in_beforeCount, int in_afterCount, int in_versionId, IServerCallback * in_callback = NULL);

/**
* Method returns a view of global leaderboard results that centers on the current player.
* By using a non-current version id, the user can retrieve a historical leaderboard.
* See GetGlobalLeaderboardVersions method to retrieve the version id.
*
* This method returns the same data as getGlobalLeaderboardViewByVersion, but it will not return an error if the leaderboard does not exist.
*
* Service Name - SocialLeaderboard
* Service Operation - GET_GLOBAL_LEADERBOARD_VIEW_IF_EXISTS
*
* @param in_leaderboardId The id of the leaderboard to retrieve.
* @param in_sort Sort key Sort order of page.
* @param in_beforeCount The count of number of players before the current player to include.
* @param in_afterCount The count of number of players after the current player to include.
* @param in_versionId The historical version to retrieve.
* @param in_callback The method to be invoked when the server response is received
*/
void getGlobalLeaderboardViewByVersionIfExists(const char * in_leaderboardId, SortOrder in_sortOrder, int in_beforeCount, int in_afterCount, int in_versionId, IServerCallback * in_callback = NULL);

/** Gets the global leaderboard versions.
*
* Service Name - SocialLeaderboard
Expand Down Expand Up @@ -248,6 +386,46 @@ namespace BrainCloud
int in_retainedCount,
IServerCallback * in_callback = NULL);

/**
* Post the player's score to the given social leaderboard,
* dynamically creating the leaderboard if it does not exist yet.
* To create new leaderboard, configJson must specify leaderboardType, rotationType, resetAt, and retainedCount, at a minimum, with support to optionally specify an expiry in minutes.
*
* Service Name - SocialLeaderboard
* Service Operation - POST_SCORE_DYNAMIC_USING_CONFIG
*
* @param in_leaderboardId The leaderboard to post to.
* @param in_score A score to post.
* @param in_scoreData Optional user-defined data to post with the score.
* @param in_configJson Configuration for the leaderboard if it does not exist yet, specified as JSON object.
* Configuration fields supported are:
* 'leaderboardType': Required. Type of leaderboard. Valid values are:
* 'LAST_VALUE',
* 'HIGH_VALUE',
* 'LOW_VALUE',
* 'CUMULATIVE',
* 'ARCADE_HIGH',
* 'ARCADE_LOW';
* 'rotationType': Required. Type of rotation. Valid values are:
* 'NEVER',
* 'DAILY',
* 'DAYS',
* 'WEEKLY',
* 'MONTHLY',
* 'YEARLY';
* 'numDaysToRotate': Required if 'DAYS' rotation type, with valid values between 2 and 14; otherwise, null;
* 'resetAt': UTC timestamp, in milliseconds, at which to rotate the period. Always null if 'NEVER' rotation type;
* 'retainedCount': Required. Number of rotations (versions) of the leaderboard to retain;
* 'expireInMins': Optional. Duration, in minutes, before the leaderboard is to automatically expire.
* @param in_callback The method to be invoked when the server response is received.
*/
void postScoreToDynamicLeaderboardUsingConfig(
const char * in_leaderboardId,
int64_t in_score,
const std::string& in_scoreData,
const std::string& in_configJson,
IServerCallback * in_callback = NULL);

/**
* Post the players score to the given social leaderboard.
* Pass leaderboard config data to dynamically create if necessary.
Expand Down Expand Up @@ -395,6 +573,19 @@ namespace BrainCloud
*/
void getPlayersSocialLeaderboard(const char * in_leaderboardId, std::vector<std::string> in_profileIds, IServerCallback * in_callback = NULL);

/**
* Retrieve the social leaderboard for a list of players.
* This method returns the same data as getPlayersSocialLeaderboard, but it will not return an error if the leaderboard is not found.
*
* Service Name - leaderboard
* Service Operation - GET_PLAYERS_SOCIAL_LEADERBOARD_IF_EXISTS
*
* @param in_leaderboardId The leaderboard to retrieve
* @param in_profileIds The IDs of the players
* @param in_callback The method to be invoked when the server response is received
*/
void getPlayersSocialLeaderboardIfExists(const char * in_leaderboardId, std::vector<std::string> in_profileIds, IServerCallback * in_callback = NULL);

/**
* Retrieve the social leaderboard for a list of players by its version.
*
Expand All @@ -407,6 +598,19 @@ namespace BrainCloud
*/
void getPlayersSocialLeaderboardByVersion(const char * in_leaderboardId, std::vector<std::string> in_profileIds, int in_versionId, IServerCallback * in_callback = NULL);

/**
* Retrieve the social leaderboard for a list of players by its version.
* This method returns the same data as getPlayersSocialLeaderboardByVersion, but it will not return an error if the leaderboard is not found.
*
* Service Name - leaderboard
* Service Operation - GET_PLAYERS_SOCIAL_LEADERBOARD
*
* @param in_leaderboardId The leaderboard to retrieve
* @param in_profileIds The IDs of the players
* @param in_callback The method to be invoked when the server response is received
*/
void getPlayersSocialLeaderboardByVersionIfExists(const char * in_leaderboardId, std::vector<std::string> in_profileIds, int in_versionId, IServerCallback * in_callback = NULL);

/**
* Retrieve a list of all leaderboards
*
Expand Down
2 changes: 2 additions & 0 deletions include/braincloud/OperationParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ namespace BrainCloud {
static const OperationParam SocialLeaderboardServiceLeaderboardIds;
static const OperationParam SocialLeaderboardServiceReplaceName;
static const OperationParam SocialLeaderboardServiceScore;
static const OperationParam SocialLeaderboardServiceScoreData;
static const OperationParam SocialLeaderboardServiceConfigJson;
static const OperationParam SocialLeaderboardServiceData;
static const OperationParam SocialLeaderboardServiceEventName;
static const OperationParam SocialLeaderboardServiceEventMultiplier;
Expand Down
8 changes: 8 additions & 0 deletions include/braincloud/ServiceOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,21 @@ namespace BrainCloud {
static const ServiceOperation GetUsersOnlineStatus;
static const ServiceOperation FindPlayerByUniversalId;
static const ServiceOperation GetSocialLeaderboard;
static const ServiceOperation GetSocialLeaderboardIfExists;
static const ServiceOperation GetSocialLeaderboardByVersion;
static const ServiceOperation GetSocialLeaderboardByVersionIfExists;
static const ServiceOperation GetMultiSocialLeaderboard;
static const ServiceOperation GetGlobalLeaderboard;
static const ServiceOperation GetGlobalLeaderboardPage;
static const ServiceOperation GetGlobalLeaderboardPageIfExists;
static const ServiceOperation GetGlobalLeaderboardView;
static const ServiceOperation GetGlobalLeaderboardViewIfExists;
static const ServiceOperation GetGlobalLeaderboardVersions;
static const ServiceOperation GetCompletedTournament;
static const ServiceOperation RewardTournament;
static const ServiceOperation PostScore;
static const ServiceOperation PostScoreDynamic;
static const ServiceOperation PostScoreDynamicUsingConfig;
static const ServiceOperation GetGroupSocialLeaderboard;
static const ServiceOperation GetGroupSocialLeaderboardByVersion;
static const ServiceOperation PostScoreToGroupLeaderboard;
Expand All @@ -127,7 +132,9 @@ namespace BrainCloud {
static const ServiceOperation GetGroupLeaderboardView;
static const ServiceOperation GetSummaryDataForProfileId;
static const ServiceOperation GetPlayersSocialLeaderboard;
static const ServiceOperation GetPlayersSocialLeaderboardIfExists;
static const ServiceOperation GetPlayersSocialLeaderboardByVersion;
static const ServiceOperation GetPlayersSocialLeaderboardByVersionIfExists;
static const ServiceOperation ListAllLeaderboards;
static const ServiceOperation GetGlobalLeaderboardEntryCount;
static const ServiceOperation RemovePlayerScore;
Expand Down Expand Up @@ -158,6 +165,7 @@ namespace BrainCloud {

static const ServiceOperation Send;
static const ServiceOperation UpdateEventData;
static const ServiceOperation UpdateEventDataIfExists;
static const ServiceOperation DeleteSent;
static const ServiceOperation DeleteIncoming;
static const ServiceOperation DeleteIncomingEvents;
Expand Down
2 changes: 1 addition & 1 deletion src/BrainCloudClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace BrainCloud
"Singleton usage is disabled. If called by mistake, use your own variable that holds an instance of the bcWrapper/bcClient.";

BrainCloudClient * BrainCloudClient::_instance = NULL;
std::string BrainCloudClient::s_brainCloudClientVersion = "5.3.0";
std::string BrainCloudClient::s_brainCloudClientVersion = "5.4.0";
const char* BC_SERVER_URL = "https://api.braincloudservers.com/dispatcherv2";

/**
Expand Down
10 changes: 10 additions & 0 deletions src/BrainCloudEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ namespace BrainCloud
m_client->getBrainCloudComms()->addToQueue(sc);
}

void BrainCloudEvent::updateIncomingEventDataIfExists(const char * in_evId, const std::string& in_jsonEventData, IServerCallback * in_callback)
{
Json::Value message;
message[OperationParam::EvId.getValue()] = in_evId;
message[OperationParam::EventServiceUpdateEventDataData.getValue()] = JsonUtil::jsonStringToValue(in_jsonEventData);

ServerCall * sc = new ServerCall(ServiceName::Event, ServiceOperation::UpdateEventDataIfExists, message, in_callback);
m_client->getBrainCloudComms()->addToQueue(sc);
}

void BrainCloudEvent::deleteIncomingEvent(const char * in_evId, IServerCallback * in_callback)
{
Json::Value message;
Expand Down
Loading

0 comments on commit 0f03923

Please sign in to comment.