Skip to content

Commit

Permalink
https://docs.microsoft.com/en-us/gaming/playfab/release-notes/#200518
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFabJenkinsBot committed May 18, 2020
1 parent 8daac2c commit 5321470
Show file tree
Hide file tree
Showing 56 changed files with 759 additions and 179 deletions.
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabAdminApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace PlayFab
class PlayFabAdminAPI
{
public:
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Admin.Update();
/// </summary>
static size_t Update();
static void ForgetAllCredentials();

Expand Down
33 changes: 33 additions & 0 deletions code/include/playfab/PlayFabAdminDataModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -5389,6 +5389,8 @@ namespace PlayFab
GenericErrorCodesXboxServiceTooManyRequests,
GenericErrorCodesNintendoSwitchNotEnabledForTitle,
GenericErrorCodesRequestMultiplayerServersThrottledFromRateLimiter,
GenericErrorCodesTitleDataInstanceNotFound,
GenericErrorCodesDuplicateTitleDataOverrideInstanceName,
GenericErrorCodesMatchmakingEntityInvalid,
GenericErrorCodesMatchmakingPlayerAttributesInvalid,
GenericErrorCodesMatchmakingQueueNotFound,
Expand Down Expand Up @@ -5469,6 +5471,7 @@ namespace PlayFab
GenericErrorCodesExperimentationInvalidDuration,
GenericErrorCodesExperimentationMaxExperimentsReached,
GenericErrorCodesExperimentationExperimentSchedulingInProgress,
GenericErrorCodesExperimentationExistingCodelessScheduled,
GenericErrorCodesMaxActionDepthExceeded,
GenericErrorCodesTitleNotOnUpdatedPricingPlan,
GenericErrorCodesSnapshotNotFound
Expand Down Expand Up @@ -7961,6 +7964,16 @@ namespace PlayFab
output = Json::Value("RequestMultiplayerServersThrottledFromRateLimiter");
return;
}
if (input == GenericErrorCodes::GenericErrorCodesTitleDataInstanceNotFound)
{
output = Json::Value("TitleDataInstanceNotFound");
return;
}
if (input == GenericErrorCodes::GenericErrorCodesDuplicateTitleDataOverrideInstanceName)
{
output = Json::Value("DuplicateTitleDataOverrideInstanceName");
return;
}
if (input == GenericErrorCodes::GenericErrorCodesMatchmakingEntityInvalid)
{
output = Json::Value("MatchmakingEntityInvalid");
Expand Down Expand Up @@ -8361,6 +8374,11 @@ namespace PlayFab
output = Json::Value("ExperimentationExperimentSchedulingInProgress");
return;
}
if (input == GenericErrorCodes::GenericErrorCodesExperimentationExistingCodelessScheduled)
{
output = Json::Value("ExperimentationExistingCodelessScheduled");
return;
}
if (input == GenericErrorCodes::GenericErrorCodesMaxActionDepthExceeded)
{
output = Json::Value("MaxActionDepthExceeded");
Expand Down Expand Up @@ -10869,6 +10887,16 @@ namespace PlayFab
output = GenericErrorCodes::GenericErrorCodesRequestMultiplayerServersThrottledFromRateLimiter;
return;
}
if (inputStr == "TitleDataInstanceNotFound")
{
output = GenericErrorCodes::GenericErrorCodesTitleDataInstanceNotFound;
return;
}
if (inputStr == "DuplicateTitleDataOverrideInstanceName")
{
output = GenericErrorCodes::GenericErrorCodesDuplicateTitleDataOverrideInstanceName;
return;
}
if (inputStr == "MatchmakingEntityInvalid")
{
output = GenericErrorCodes::GenericErrorCodesMatchmakingEntityInvalid;
Expand Down Expand Up @@ -11269,6 +11297,11 @@ namespace PlayFab
output = GenericErrorCodes::GenericErrorCodesExperimentationExperimentSchedulingInProgress;
return;
}
if (inputStr == "ExperimentationExistingCodelessScheduled")
{
output = GenericErrorCodes::GenericErrorCodesExperimentationExistingCodelessScheduled;
return;
}
if (inputStr == "MaxActionDepthExceeded")
{
output = GenericErrorCodes::GenericErrorCodesMaxActionDepthExceeded;
Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabAdminInstanceApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ namespace PlayFab

std::shared_ptr<PlayFabApiSettings> GetSettings() const;
std::shared_ptr<PlayFabAuthenticationContext> GetAuthenticationContext() const;
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Admin.Update();
/// </summary>
size_t Update();
void ForgetAllCredentials();

Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabAuthenticationApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace PlayFab
class PlayFabAuthenticationAPI
{
public:
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Authentication.Update();
/// </summary>
static size_t Update();
static void ForgetAllCredentials();

Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabAuthenticationInstanceApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ namespace PlayFab

std::shared_ptr<PlayFabApiSettings> GetSettings() const;
std::shared_ptr<PlayFabAuthenticationContext> GetAuthenticationContext() const;
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Authentication.Update();
/// </summary>
size_t Update();
void ForgetAllCredentials();

Expand Down
2 changes: 1 addition & 1 deletion code/include/playfab/PlayFabCallRequestContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace PlayFab
std::shared_ptr<PlayFabAuthenticationContext> GetContext() const;
std::string GetRequestId() const;
void SetRequestId(const std::string& newRequestId);
bool HandleInvalidSettings();
void ThrowIfSettingsInvalid();

// TODO: clean up these public variables with setters/getters when you have the chance.

Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabClientApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace PlayFab
class PlayFabClientAPI
{
public:
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Client.Update();
/// </summary>
static size_t Update();
static void ForgetAllCredentials();

Expand Down
13 changes: 9 additions & 4 deletions code/include/playfab/PlayFabClientDataModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -19197,24 +19197,29 @@ namespace PlayFab

struct UnlinkTwitchAccountRequest : public PlayFabRequestCommon
{
std::string AccessToken;

UnlinkTwitchAccountRequest() :
PlayFabRequestCommon()
PlayFabRequestCommon(),
AccessToken()
{}

UnlinkTwitchAccountRequest(const UnlinkTwitchAccountRequest&) :
PlayFabRequestCommon()
UnlinkTwitchAccountRequest(const UnlinkTwitchAccountRequest& src) :
PlayFabRequestCommon(),
AccessToken(src.AccessToken)
{}

~UnlinkTwitchAccountRequest() = default;

void FromJson(const Json::Value&) override
void FromJson(const Json::Value& input) override
{
FromJsonUtilS(input["AccessToken"], AccessToken);
}

Json::Value ToJson() const override
{
Json::Value output;
Json::Value each_AccessToken; ToJsonUtilS(AccessToken, each_AccessToken); output["AccessToken"] = each_AccessToken;
return output;
}
};
Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabClientInstanceApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ namespace PlayFab

std::shared_ptr<PlayFabApiSettings> GetSettings() const;
std::shared_ptr<PlayFabAuthenticationContext> GetAuthenticationContext() const;
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Client.Update();
/// </summary>
size_t Update();
void ForgetAllCredentials();

Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabCloudScriptApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace PlayFab
class PlayFabCloudScriptAPI
{
public:
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// CloudScript.Update();
/// </summary>
static size_t Update();
static void ForgetAllCredentials();

Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabCloudScriptInstanceApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ namespace PlayFab

std::shared_ptr<PlayFabApiSettings> GetSettings() const;
std::shared_ptr<PlayFabAuthenticationContext> GetAuthenticationContext() const;
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// CloudScript.Update();
/// </summary>
size_t Update();
void ForgetAllCredentials();

Expand Down
6 changes: 6 additions & 0 deletions code/include/playfab/PlayFabCurlHttpPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <playfab/PlayFabCallRequestContainer.h>
#include <playfab/PlayFabPluginManager.h>
#include <playfab/PlayFabError.h>
#include <curl/curl.h>
#include <functional>
#include <deque>
#include <memory>
Expand Down Expand Up @@ -42,5 +43,10 @@ namespace PlayFab
int activeRequestCount;
std::deque<std::unique_ptr<CallRequestContainerBase>> pendingRequests;
std::deque<std::unique_ptr<CallRequestContainerBase>> pendingResults;

private:
void CurlHeaderFailed(CallRequestContainer& requestContainer, const char* failedHeader);
curl_slist* SetPredefinedHeaders(CallRequestContainer& requestContainer);
curl_slist* TryCurlAddHeader(CallRequestContainer& requestContainer, curl_slist* list, const char* headerToAppend);
};
}
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabDataApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ namespace PlayFab
class PlayFabDataAPI
{
public:
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Data.Update();
/// </summary>
static size_t Update();
static void ForgetAllCredentials();

Expand Down
8 changes: 8 additions & 0 deletions code/include/playfab/PlayFabDataInstanceApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ namespace PlayFab

std::shared_ptr<PlayFabApiSettings> GetSettings() const;
std::shared_ptr<PlayFabAuthenticationContext> GetAuthenticationContext() const;
/// <summary>
/// Calls the Update function on your implementation of the IHttpPlugin to check for responses to HTTP requests.
/// All api's (Client, Server, Admin etc.) share the same IHttpPlugin.
/// This means that you only need to call Update() on one API to retrieve the responses for all APIs.
/// Additional calls to Update (on any API) during the same tick are unlikely to retrieve additional responses.
/// Call Update when your game ticks as follows:
/// Data.Update();
/// </summary>
size_t Update();
void ForgetAllCredentials();

Expand Down
3 changes: 3 additions & 0 deletions code/include/playfab/PlayFabError.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ namespace PlayFab
PlayFabErrorXboxServiceTooManyRequests = 1505,
PlayFabErrorNintendoSwitchNotEnabledForTitle = 1506,
PlayFabErrorRequestMultiplayerServersThrottledFromRateLimiter = 1507,
PlayFabErrorTitleDataInstanceNotFound = 1508,
PlayFabErrorDuplicateTitleDataOverrideInstanceName = 1509,
PlayFabErrorMatchmakingEntityInvalid = 2001,
PlayFabErrorMatchmakingPlayerAttributesInvalid = 2002,
PlayFabErrorMatchmakingQueueNotFound = 2016,
Expand Down Expand Up @@ -588,6 +590,7 @@ namespace PlayFab
PlayFabErrorExperimentationInvalidDuration = 7012,
PlayFabErrorExperimentationMaxExperimentsReached = 7013,
PlayFabErrorExperimentationExperimentSchedulingInProgress = 7014,
PlayFabErrorExperimentationExistingCodelessScheduled = 7015,
PlayFabErrorMaxActionDepthExceeded = 8000,
PlayFabErrorTitleNotOnUpdatedPricingPlan = 9000,
PlayFabErrorSnapshotNotFound = 11000,
Expand Down
9 changes: 8 additions & 1 deletion code/include/playfab/PlayFabEventApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace PlayFab
class PlayFabEventAPI
{
public:
PlayFabEventAPI(); // Default constructor
PlayFabEventAPI(bool threadedEventPipeline=true);

std::shared_ptr<IPlayFabEventRouter> GetEventRouter() const;

/// <summary>
Expand All @@ -26,6 +27,12 @@ namespace PlayFab

void EmitEvent(std::unique_ptr<const IPlayFabEvent> event, std::function<void(std::shared_ptr<const IPlayFabEvent>, std::shared_ptr<const IPlayFabEmitEventResponse>)> callback) const;

/// <summary>
/// Updates the underlying event router which in turn will update the eventpipeline.
/// This function must be called every game tick if threadedEventPipeline is set to false
/// </summary>
void Update();

private:
std::shared_ptr<IPlayFabEventRouter> eventRouter;
};
Expand Down
16 changes: 13 additions & 3 deletions code/include/playfab/PlayFabEventPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace PlayFab
public:
PlayFabEventPipelineSettings();
PlayFabEventPipelineSettings(PlayFabEventPipelineType emitType);
PlayFabEventPipelineSettings(PlayFabEventPipelineType emitType, bool useBackgroundThread);
virtual ~PlayFabEventPipelineSettings() {};

size_t bufferSize; // The minimal size of buffer, in bytes. The actually allocated size will be a power of 2 that is equal or greater than this value.
Expand All @@ -42,6 +43,7 @@ namespace PlayFab
int64_t readBufferWaitTime; // The wait time between attempts to read events from buffer when it is empty, in milliseconds.
std::shared_ptr<PlayFabAuthenticationContext> authenticationContext; // The optional PlayFab authentication context that can be used with static PlayFab events API
PlayFabEventPipelineType emitType; // whether we call WriteEvent or WriteTelemetryEvent through PlayFab
bool useBackgroundThread;
};

/// <summary>
Expand All @@ -52,6 +54,8 @@ namespace PlayFab
public:
virtual ~IPlayFabEventPipeline() {}
virtual void Start() {} // Start pipeline's worker thread
virtual void Stop() = 0;
virtual void Update() = 0;
virtual void IntakeEvent(std::shared_ptr<const IPlayFabEmitEventRequest> request) = 0; // Intake an event. This method must be thread-safe.
};

Expand All @@ -70,19 +74,23 @@ namespace PlayFab
PlayFabEventPipeline& operator=(PlayFabEventPipeline&& other) = delete; // disable move assignment

// NOTE: settings are expected to be set prior to calling PlayFabEventPipeline::Start()
// changing them after PlayFabEventPipeline::Start() may cause threading issues
// users should not expect changes made to settings to take effect after ::Start is called unless the pipeline is destroyed and re-created
// changing them after PlayFabEventPipeline::Start() may cause threading issues unless you have set useBackgroundThread flag to true
// If this flag is not set, users should not expect changes made to settings to take effect after ::Start is called
// unless the pipeline is A.) destroyed and re-created or B.) restart it by running Stop() and then Start() again
std::shared_ptr<PlayFabEventPipelineSettings> GetSettings() const;
virtual void Start() override;
virtual void Stop() override;
virtual void Update() override;
virtual void IntakeEvent(std::shared_ptr<const IPlayFabEmitEventRequest> request) override;

void SetExceptionCallback(ExceptionCallback callback);

protected:
virtual void SendBatch(std::vector<std::shared_ptr<const IPlayFabEmitEventRequest>>& batch, uintptr_t& batchCounter);
virtual void SendBatch(std::vector<std::shared_ptr<const IPlayFabEmitEventRequest>>& batch);

private:
void WorkerThread();
bool DoWork();
void WriteEventsApiCallback(const EventsModels::WriteEventsResponse& result, void* customData);
void WriteEventsApiErrorCallback(const PlayFabError& error, void* customData);
void CallbackRequest(std::shared_ptr<const IPlayFabEmitEventRequest> request, std::shared_ptr<const IPlayFabEmitEventResponse> response);
Expand All @@ -99,6 +107,8 @@ namespace PlayFab
private:
std::shared_ptr<PlayFabEventsInstanceAPI> eventsApi;

std::atomic_uintptr_t batchCounter;
std::chrono::steady_clock::time_point momentBatchStarted;
std::shared_ptr<PlayFabEventPipelineSettings> settings;
PlayFabEventBuffer buffer;
std::thread workerThread;
Expand Down
Loading

0 comments on commit 5321470

Please sign in to comment.