Skip to content

Commit

Permalink
Updated from pipeline, Version : 26.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AccelByte-Build committed Jul 10, 2024
1 parent dc8536a commit 2f688f1
Show file tree
Hide file tree
Showing 13 changed files with 346 additions and 50 deletions.
13 changes: 6 additions & 7 deletions .variables
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export DO_UPDATE=true
export LEVEL=CRITICAL
export REPO_NAME=justice-unreal-sdk-plugin
export WORKDIR=/tmp/pipelines/7272771584/1361819099/
export COMMIT_HASH=edffe839efc117d94c6650bb36a5904883d2b90c
export GIT_HASH=edffe839efc117d94c6650bb36a5904883d2b90c
export VERSION=26.0.0
export REVISION_ID=26.0.0
export WORKDIR=/tmp/pipelines/7306428285/1367733336/
export COMMIT_HASH=202166e3284d36a5ebb1a7658542a7c19f037772
export GIT_HASH=202166e3284d36a5ebb1a7658542a7c19f037772
export VERSION=26.0.1
export REVISION_ID=26.0.1
export [email protected]
export COMMIT_MESSAGE_BASE64='Y2hvcmUocmVsZWFzZSk6IDI2LjAuMCAtIGNvbW1pdGVkIGFuZCB0YWdnZWQgYnkgSmVua2luc2Fnc1ZlcnNpb246IjMuNzUuMCIKCg=='
export COMMIT_MESSAGE_BASE64='Y2hvcmUocmVsZWFzZSk6IDI2LjAuMSAtIGNvbW1pdGVkIGFuZCB0YWdnZWQgYnkgSmVua2lucwo='
4 changes: 2 additions & 2 deletions AccelByteUe4Sdk.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 71,
"VersionName": "26.0.0",
"Version": 72,
"VersionName": "26.0.1",
"FriendlyName": "AccelByte Unreal Engine SDK",
"Description": "Official AccelByte SDK for Unreal Engine 4",
"Category": "Online Platform",
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [26.0.1](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/26.0.1%0D26.0.0) (2024-07-10)


### Features

* **Agreement:** add change policy preferences ([fb82474](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/fb82474e01884078698a43f4759f3e8be8ca3bdd))


### Bug Fixes

* **challenge:** update data model and add request validation ([780a246](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/780a2468fb7752453562587dbd129a7d6a06a7e2))

## [26.0.0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/26.0.0%0D25.5.2) (2024-07-05)


Expand Down
36 changes: 36 additions & 0 deletions Source/AccelByteUe4Sdk/Private/Api/AccelByteAgreementApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,42 @@ FAccelByteTaskWPtr Agreement::AcceptPolicyVersion(FString const& LocalizedPolicy
return HttpClient.ApiRequest(TEXT("POST"), Url, {}, FString(), OnSuccess, OnError);
}

FAccelByteTaskWPtr Agreement::ChangePolicyPreferences(TArray<FAccelByteModelsChangeAgreementRequest> const& ChangeAgreementRequests
, FVoidHandler const& OnSuccess
, FErrorHandler const& OnError)
{
FReport::Log(FString(__FUNCTION__));

if (ChangeAgreementRequests.Num() == 0)
{
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("Cannot change preference for current consent. Request is empty."));
return nullptr;
}

// Validate each request to make sure they are not failing later.
for (const FAccelByteModelsAcceptAgreementRequest& ChangeAgreement : ChangeAgreementRequests)
{
if (ChangeAgreement.PolicyVersionId.IsEmpty())
{
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("Cannot change preference for current consent. Policy version id is empty."));
return nullptr;
}
if (ChangeAgreement.LocalizedPolicyVersionId.IsEmpty())
{
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("Cannot change preference for current consent. Localized policy id is empty."));
return nullptr;
}
}

const FString Url = FString::Printf(TEXT("%s/public/agreements/localized-policy-versions/preferences")
, *SettingsRef.AgreementServerUrl);

FString Content;
FAccelByteUtilities::TArrayUStructToJsonString(ChangeAgreementRequests, Content);

return HttpClient.ApiRequest(TEXT("PATCH"), Url, {}, Content, OnSuccess, OnError);
}

FAccelByteTaskWPtr Agreement::QueryLegalEligibilities(FString const& Namespace
, THandler<TArray<FAccelByteModelsRetrieveUserEligibilitiesResponse>> const& OnSuccess
, FErrorHandler const& OnError)
Expand Down
87 changes: 69 additions & 18 deletions Source/AccelByteUe4Sdk/Private/Api/AccelByteChallengeApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@ FAccelByteTaskWPtr Challenge::GetChallenges(THandler<FAccelByteModelsGetChalleng
{
FReport::Log(FString(__FUNCTION__));

const TMap<FString, FString> QueryParams = {
{ TEXT("sortBy"), FAccelByteUtilities::ConvertChallengeSortByToString(SortBy) },
{ TEXT("status"), (Status != EAccelByteModelsChallengeStatus::NONE) ? FAccelByteUtilities::GetUEnumValueAsString(Status) : FString() },
TMap<FString, FString> QueryParams = {
{ TEXT("offset"), FString::FromInt(Offset) },
{ TEXT("limit"), FString::FromInt(Limit) },
};

if (SortBy != EAccelByteModelsChallengeSortBy::NONE)
{
QueryParams.Emplace(TEXT("sortBy"), FAccelByteUtilities::ConvertChallengeSortByToString(SortBy));
}

if (Status != EAccelByteModelsChallengeStatus::NONE)
{
QueryParams.Emplace(TEXT("status"), FAccelByteUtilities::GetUEnumValueAsString(Status));
}

const FString Url = FString::Printf(TEXT("%s/v1/public/namespaces/%s/challenges")
, *SettingsRef.ChallengeServerUrl
, *CredentialsRef->GetNamespace());
Expand All @@ -46,28 +54,29 @@ FAccelByteTaskWPtr Challenge::GetChallenges(THandler<FAccelByteModelsGetChalleng
FAccelByteTaskWPtr Challenge::GetScheduledChallengeGoals(FString const& ChallengeCode
, THandler<FAccelByteModelsGetScheduledChallengeGoalsResponse> const& OnSuccess
, FErrorHandler const& OnError
, TArray<FString> Tags
, const TArray<FString>& Tags
, uint64 Offset
, uint64 Limit)
{
FReport::Log(FString(__FUNCTION__));

FString TagsString{};
for (int64 Index = 0; Index < Tags.Num(); Index++)
if (ChallengeCode.IsEmpty())
{
TagsString.Append(Tags[Index]);
if (Index != Tags.Num() - 1)
{
TagsString.AppendChar(',');
}
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("ChallengeCode cannot be empty."));
return nullptr;
}

const TMap<FString, FString> QueryParams{
{ TEXT("tags"), FGenericPlatformHttp::UrlEncode(TagsString) },
TMap<FString, FString> QueryParams{
{ TEXT("offset"), FString::FromInt(Offset) },
{ TEXT("limit"), FString::FromInt(Limit) },
};

if (Tags.Num() > 0)
{
FString TagsString = CreateTagsString(Tags);
QueryParams.Emplace(TEXT("tags"), TagsString);
}

const FString Url = FString::Printf(TEXT("%s/v1/public/namespaces/%s/challenges/%s/goals")
, *SettingsRef.ChallengeServerUrl
, *CredentialsRef->GetNamespace()
Expand All @@ -81,16 +90,33 @@ FAccelByteTaskWPtr Challenge::GetChallengeProgress(FString const& ChallengeCode
, THandler<FAccelByteModelsChallengeProgressResponse> const& OnSuccess
, FErrorHandler const& OnError
, uint64 Offset
, uint64 Limit)
, uint64 Limit
, TArray<FString> const& Tags)
{
FReport::Log(FString(__FUNCTION__));

const TMap<FString, FString> QueryParams{
{ TEXT("goalCode"), GoalCode },
if (ChallengeCode.IsEmpty())
{
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("ChallengeCode cannot be empty."));
return nullptr;
}

TMap<FString, FString> QueryParams{
{ TEXT("offset"), FString::FromInt(Offset) },
{ TEXT("limit"), FString::FromInt(Limit) },
};

if (!GoalCode.IsEmpty())
{
QueryParams.Emplace(TEXT("goalCode"), GoalCode);
}

if (Tags.Num() > 0)
{
FString TagsString = CreateTagsString(Tags);
QueryParams.Emplace(TEXT("tags"), TagsString);
}

const FString Url = FString::Printf(TEXT("%s/v1/public/namespaces/%s/users/me/progress/%s")
, *SettingsRef.ChallengeServerUrl
, *CredentialsRef->GetNamespace()
Expand All @@ -109,14 +135,18 @@ FAccelByteTaskWPtr Challenge::GetRewards(THandler<FAccelByteModelsChallengeGetRe
FReport::Log(FString(__FUNCTION__));

TMap<FString, FString> QueryParams{
{ TEXT("sortBy"), FAccelByteUtilities::ConvertChallengeSortByToString(SortBy) },
{ TEXT("offset"), FString::FromInt(Offset) },
{ TEXT("limit"), FString::FromInt(Limit) },
};

if (SortBy != EAccelByteModelsChallengeSortBy::NONE)
{
QueryParams.Emplace(TEXT("sortBy"), FAccelByteUtilities::ConvertChallengeSortByToString(SortBy));
}

if (Status != EAccelByteModelsChallengeRewardStatus::NONE)
{
QueryParams.Add(TEXT("status"), FAccelByteUtilities::GetUEnumValueAsString(Status));
QueryParams.Emplace(TEXT("status"), FAccelByteUtilities::GetUEnumValueAsString(Status));
}

const FString Url = FString::Printf(TEXT("%s/v1/public/namespaces/%s/users/me/rewards")
Expand All @@ -131,6 +161,12 @@ FAccelByteTaskWPtr Challenge::ClaimReward(FAccelByteModelsChallengeRewardClaimRe
, FErrorHandler const& OnError)
{
FReport::Log(FString(__FUNCTION__));

if(Request.RewardIDs.Num() < 1)
{
OnError.ExecuteIfBound(static_cast<int32>(ErrorCodes::InvalidRequest), TEXT("RewardIDs cannot be empty."));
return nullptr;
}

const FString Url = FString::Printf(TEXT("%s/v1/public/namespaces/%s/users/me/rewards/claim")
, *SettingsRef.ChallengeServerUrl
Expand All @@ -151,6 +187,21 @@ FAccelByteTaskWPtr Challenge::EvaluateChallengeProgress(FVoidHandler const& OnSu
return HttpClient.ApiRequest(TEXT("POST"), Url, {}, FString(), OnSuccess, OnError);
}

FString Challenge::CreateTagsString(const TArray<FString>& Tags)
{
FString TagsString;

for (int64 Index = 0; Index < Tags.Num(); Index++)
{
TagsString.Append(Tags[Index]);
if (Index != Tags.Num() - 1)
{
TagsString.AppendChar(',');
}
}

return TagsString;
}

} // Namespace Api
} // Namespace AccelByte
22 changes: 22 additions & 0 deletions Source/AccelByteUe4Sdk/Private/Blueprints/ABAgreement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,28 @@ void UABAgreement::AcceptPolicyVersion(
);
}

void UABAgreement::ChangePolicyPreferences(
TArray<FAccelByteModelsChangeAgreementRequest> const& ChangeAgreementRequests,
FDHandler const& OnSuccess,
FDErrorHandler const& OnError)
{
ApiClientPtr->Agreement.ChangePolicyPreferences(
ChangeAgreementRequests,
FVoidHandler::CreateLambda(
[OnSuccess]()
{
OnSuccess.ExecuteIfBound();
}
),
FErrorHandler::CreateLambda(
[OnError](int Code, FString const& Message)
{
OnError.ExecuteIfBound(Code, Message);
}
)
);
}

void UABAgreement::QueryLegalEligibilities(
FString const& Namespace,
FDArrayModelsRetrieveUserEligibilitiesResponse const& OnSuccess,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ FAccelByteTaskWPtr ServerChallenge::GetUserRewards(const FString& UserId

TMap<FString, FString> QueryParams
{
{ TEXT("sortBy"), FAccelByteUtilities::ConvertChallengeSortByToString(SortBy) },
{ TEXT("offset"), FString::FromInt(Offset) },
{ TEXT("limit"), FString::FromInt(Limit) },
};

if (SortBy != EAccelByteModelsChallengeSortBy::NONE)
{
QueryParams.Add(TEXT("sortBy"), FAccelByteUtilities::ConvertChallengeSortByToString(SortBy));
}

if (Status != EAccelByteModelsChallengeRewardStatus::NONE)
{
QueryParams.Add(TEXT("status"), FAccelByteUtilities::GetUEnumValueAsString(Status));
Expand Down
13 changes: 13 additions & 0 deletions Source/AccelByteUe4Sdk/Public/Api/AccelByteAgreementApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ class ACCELBYTEUE4SDK_API Agreement : public FApiBase
, FVoidHandler const& OnSuccess
, FErrorHandler const& OnError);

/**
* @brief Accept or changes preference to specific legal policy versions.
*
* @param ChangeAgreementRequests Request for localized policy version id to change.
* @param OnSuccess This will be called when the operation succeeded.
* @param OnError This will be called when the operation failed.
*
* @return AccelByteTask object to track and cancel the ongoing API operation.
*/
FAccelByteTaskWPtr ChangePolicyPreferences(TArray<FAccelByteModelsChangeAgreementRequest> const& ChangeAgreementRequests
, FVoidHandler const& OnSuccess
, FErrorHandler const& OnError);

/**
* @brief Query all player's legal eligibilities on a namespace, use to check is player already commited to legal or not.
*
Expand Down
7 changes: 5 additions & 2 deletions Source/AccelByteUe4Sdk/Public/Api/AccelByteChallengeApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ACCELBYTEUE4SDK_API Challenge : public FApiBase
FAccelByteTaskWPtr GetScheduledChallengeGoals(FString const& ChallengeCode
, THandler<FAccelByteModelsGetScheduledChallengeGoalsResponse> const& OnSuccess
, FErrorHandler const& OnError
, TArray<FString> Tags = {}
, const TArray<FString>& Tags = {}
, uint64 Offset = 0
, uint64 Limit = 20);

Expand All @@ -73,6 +73,7 @@ class ACCELBYTEUE4SDK_API Challenge : public FApiBase
* @param OnError Delegate executed when request fails
* @param Offset Number of goals to skip when returning goal progress list, defaults to 0
* @param Limit Number of goals to include when returning goal progress list, defaults to 20
* @param Tags Array of tag strings used to filter resulting challenge progress list
*
* @return AccelByteTask object to track and cancel the ongoing API operation.
*/
Expand All @@ -81,7 +82,8 @@ class ACCELBYTEUE4SDK_API Challenge : public FApiBase
, THandler<FAccelByteModelsChallengeProgressResponse> const& OnSuccess
, FErrorHandler const& OnError
, uint64 Offset = 0
, uint64 Limit = 20);
, uint64 Limit = 20
, TArray<FString> const& Tags = {});

/**
* @brief Send a request to get status of all challenge rewards
Expand Down Expand Up @@ -131,6 +133,7 @@ class ACCELBYTEUE4SDK_API Challenge : public FApiBase
Challenge(Challenge const&) = delete;
Challenge(Challenge&&) = delete;

static FString CreateTagsString(const TArray<FString>& Tags);
};

} // Namespace Api
Expand Down
6 changes: 6 additions & 0 deletions Source/AccelByteUe4Sdk/Public/Blueprints/ABAgreement.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ class UABAgreement : public UObject
FDHandler const& OnSuccess,
FDErrorHandler const& OnError);

UFUNCTION(BlueprintCallable, Category = "AccelByte | Agreement | Api")
void ChangePolicyPreferences(
TArray<FAccelByteModelsChangeAgreementRequest> const& ChangeAgreementRequests,
FDHandler const& OnSuccess,
FDErrorHandler const& OnError);

UFUNCTION(BlueprintCallable, Category = "AccelByte | Agreement | Api")
void QueryLegalEligibilities(
FString const& Namespace,
Expand Down
13 changes: 12 additions & 1 deletion Source/AccelByteUe4Sdk/Public/Models/AccelByteAgreementModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ struct ACCELBYTEUE4SDK_API FAccelByteModelsAcceptAgreementRequest

/** @brief Flag that the Agreement is accepted */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AccelByte | Agreement | Models | AcceptAgreementRequest")
bool IsAccepted{};
bool IsAccepted{false};
};

/** @brief Data Model for Changing request of specific Agreement */
USTRUCT(BlueprintType)
struct ACCELBYTEUE4SDK_API FAccelByteModelsChangeAgreementRequest : public FAccelByteModelsAcceptAgreementRequest
{
GENERATED_BODY()

/** @brief Flag that the Agreement is needed for marketing */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AccelByte | Agreement | Models | ChangeAgreementRequest")
bool IsNeedToSendEventMarketing{false};
};

/** @brief Data Model for Accept Agreement Response */
Expand Down
Loading

0 comments on commit 2f688f1

Please sign in to comment.