GS2-Distributor
GS2-SDK for Game Engine Reference
SDK for Game Engine
Models
EzDistributorModel
Delivery Setting Model
A delivery setting is an entity that sets the policy when an entity's acquisition exceeds its possession quota.
By processing acquisitions through GS2-Distributor, overflow resources can be forwarded as GS2-Inbox messages.
Type | Description | |
---|---|---|
name | string | Delivery setting name |
metadata | string | metadata |
inboxNamespaceId | string | Namespace GRN |
whiteListTargetIds | List<string> | Whitelist of target resource GRNs that can be processed through the distributor |
EzDistributeResource
Type | Description | |
---|---|---|
action | enum [] | Types of actions to be performed in the stamp sheet |
request | string | JSON of request |
EzStampSheetResult
Stamp sheet execution results
Stamp sheet execution results executed using server-side stamp sheet auto-execution functionality
Type | Description | |
---|---|---|
transactionId | string | stamp-sheet transaction ID |
taskRequests | List<EzConsumeAction> | List of Stamp task request payload |
sheetRequest | EzAcquireAction | Stamp sheet request payload |
taskResults | List<string> | Stamp task execution results |
sheetResult | string | Stamp sheet execution result response content |
EzAcquireAction
Type | Description | |
---|---|---|
action | enum [] | Types of actions to be performed in the stamp sheet |
request | string | JSON of request |
EzConsumeAction
Type | Description | |
---|---|---|
action | enum [] | Types of actions to be performed in the stamp task |
request | string | JSON of the obtain request |
Methods
getDistributorModel
getDistributorModel
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).DistributorModel(
distributorName: "distributor-model-0001"
);
var item = await domain.ModelAsync();
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).DistributorModel(
distributorName: "distributor-model-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzGetDistributorModelResult> asyncResult = null;
var current = gs2.Distributor.GetDistributorModel(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001",
distributorName: "distributor-model-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->DistributorModel(
"distributor-model-0001" // distributorName
);
const auto item = Domain.Model();
}
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.getDistributorModel(
[](gs2::ez::account::AsyncEzGetDistributorModelResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.getDistributorModel failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("distributor-model-0001") // distributorName
);
Get delivery settings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
distributorName | string | ✓ | ~ 128 chars | Delivery setting name |
Result
Type | Description | |
---|---|---|
item | EzDistributorModel | Delivery Setting |
listDistributorModels
listDistributorModels
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.DistributorModelsAsync(
).ToListAsync();
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.DistributorModels(
);
List<EzDistributorModel> items = new List<EzDistributorModel>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzListDistributorModelsResult> asyncResult = null;
var current = gs2.Distributor.ListDistributorModels(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var items = result.Items;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->DistributorModels(
);
for (auto Item : *It)
{
}
}
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.describeDistributorModels(
[](gs2::ez::account::AsyncEzDescribeDistributorModelsResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.describeDistributorModels failed.");
}
else
{
Items = r.getResult()->getItems();
}
},
TCHAR_TO_ANSI("namespace-0001") // namespaceName
);
Get list of delivery settings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzDistributorModel> | List of delivery settings |
runStampSheet
runStampSheet
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzRunStampSheetResult> asyncResult = null;
var current = gs2.Distributor.RunStampSheet(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001",
stampSheet: "stampSheet",
keyId: "key-0001",
contextStack: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var result = result.Result;
}
// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// Runs at the SDK level, so there is no need to explicitly call the API
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.runStampSheet(
[](gs2::ez::account::AsyncEzRunStampSheetResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.runStampSheet failed.");
}
else
{
Result = r.getResult()->getResult();
}
},
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("stampSheet"), // stampSheet
TCHAR_TO_ANSI("key-0001") // keyId,
TCHAR_TO_ANSI(null) // contextStack
);
Run Stamp Sheet
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
stampSheet | string | ✓ | ~ 5242880 chars | Stamp sheet | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN | |
contextStack | string | ~ 32768 chars | Context of request |
Result
Type | Description | |
---|---|---|
result | string | Response content |
runStampSheetExpress
runStampSheetExpress
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzRunStampSheetExpressResult> asyncResult = null;
var current = gs2.Distributor.RunStampSheetExpress(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001",
stampSheet: "stampSheet",
keyId: "key-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var taskResults = result.TaskResults;
var sheetResult = result.SheetResult;
}
// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// Runs at the SDK level, so there is no need to explicitly call the API
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.runStampSheetExpress(
[](gs2::ez::account::AsyncEzRunStampSheetExpressResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.runStampSheetExpress failed.");
}
else
{
TaskResults = r.getResult()->getTaskResults();
SheetResult = r.getResult()->getSheetResult();
}
},
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("stampSheet"), // stampSheet
TCHAR_TO_ANSI("key-0001") // keyId
);
Batch execution of stamp tasks and stamp sheets
Batch execution reduces response time.
However, there is no guarantee of a correct retry in the event of failure in the process of stamp sheet execution.
It is strongly recommended to keep a log of stamp sheet execution in GS2-Log in case execution fails, so that appropriate action can be taken during customer support.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
stampSheet | string | ✓ | ~ 5242880 chars | Stamp sheet | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
taskResults | List<string> | Stamp task execution results |
sheetResult | string | Stamp sheet execution result response content |
runStampSheetExpressWithoutNamespace
runStampSheetExpressWithoutNamespace
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzRunStampSheetExpressWithoutNamespaceResult> asyncResult = null;
var current = gs2.Distributor.RunStampSheetExpressWithoutNamespace(
callback: r => { asyncResult = r; },
stampSheet: "stampSheet",
keyId: "key-0001"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var taskResults = result.TaskResults;
var sheetResult = result.SheetResult;
}
// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// Runs at the SDK level, so there is no need to explicitly call the API
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.runStampSheetExpressWithoutNamespace(
[](gs2::ez::account::AsyncEzRunStampSheetExpressWithoutNamespaceResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.runStampSheetExpressWithoutNamespace failed.");
}
else
{
TaskResults = r.getResult()->getTaskResults();
SheetResult = r.getResult()->getSheetResult();
}
},
TCHAR_TO_ANSI("stampSheet"), // stampSheet
TCHAR_TO_ANSI("key-0001") // keyId
);
Batch execution of stamp tasks and stamp sheets
Batch execution reduces response time.
However, there is no guarantee of a correct retry in the event of failure in the process of stamp sheet execution.
It is strongly recommended to keep a log of stamp sheet execution in GS2-Log in case execution fails, so that appropriate action can be taken during customer support.
By omitting the namespace specification, the
There are side effects such as logging not being possible and resource overflow processing not being executed.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Stamp sheet | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
taskResults | List<string> | Stamp task execution results |
sheetResult | string | Stamp sheet execution result response content |
runStampSheetWithoutNamespace
runStampSheetWithoutNamespace
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzRunStampSheetWithoutNamespaceResult> asyncResult = null;
var current = gs2.Distributor.RunStampSheetWithoutNamespace(
callback: r => { asyncResult = r; },
stampSheet: "stampSheet",
keyId: "key-0001",
contextStack: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var result = result.Result;
}
// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// Runs at the SDK level, so there is no need to explicitly call the API
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.runStampSheetWithoutNamespace(
[](gs2::ez::account::AsyncEzRunStampSheetWithoutNamespaceResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.runStampSheetWithoutNamespace failed.");
}
else
{
Result = r.getResult()->getResult();
}
},
TCHAR_TO_ANSI("stampSheet"), // stampSheet
TCHAR_TO_ANSI("key-0001") // keyId,
TCHAR_TO_ANSI(null) // contextStack
);
Run Stamp Sheet
By omitting the namespace specification, the
There are side effects such as logging not being possible and resource overflow processing not being executed.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
stampSheet | string | ✓ | ~ 5242880 chars | Stamp sheet | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN | |
contextStack | string | ~ 32768 chars | Context of request |
Result
Type | Description | |
---|---|---|
result | string | Response content |
runStampTask
runStampTask
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzRunStampTaskResult> asyncResult = null;
var current = gs2.Distributor.RunStampTask(
callback: r => { asyncResult = r; },
namespaceName: "namespace-0001",
stampTask: "stampTask",
keyId: "key-0001",
contextStack: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var result = result.Result;
}
// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// Runs at the SDK level, so there is no need to explicitly call the API
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.runStampTask(
[](gs2::ez::account::AsyncEzRunStampTaskResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.runStampTask failed.");
}
else
{
ContextStack = r.getResult()->getContextStack();
Result = r.getResult()->getResult();
}
},
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("stampTask"), // stampTask
TCHAR_TO_ANSI("key-0001") // keyId,
TCHAR_TO_ANSI(null) // contextStack
);
Run Stamp Task
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
stampTask | string | ✓ | ~ 5242880 chars | Stamp task | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN | |
contextStack | string | ~ 32768 chars | Context of request |
Result
Type | Description | |
---|---|---|
contextStack | string | Request of context reflecting task execution results |
result | string | Response content |
runStampTaskWithoutNamespace
runStampTaskWithoutNamespace
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzRunStampTaskWithoutNamespaceResult> asyncResult = null;
var current = gs2.Distributor.RunStampTaskWithoutNamespace(
callback: r => { asyncResult = r; },
stampTask: "stampTask",
keyId: "key-0001",
contextStack: null
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var result = result.Result;
}
// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// Runs at the SDK level, so there is no need to explicitly call the API
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.runStampTaskWithoutNamespace(
[](gs2::ez::account::AsyncEzRunStampTaskWithoutNamespaceResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.runStampTaskWithoutNamespace failed.");
}
else
{
ContextStack = r.getResult()->getContextStack();
Result = r.getResult()->getResult();
}
},
TCHAR_TO_ANSI("stampTask"), // stampTask
TCHAR_TO_ANSI("key-0001") // keyId,
TCHAR_TO_ANSI(null) // contextStack
);
Run stamping task
By omitting the namespace specification, the
There are side effects such as logging not being possible and resource overflow processing not being executed.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
stampTask | string | ✓ | ~ 5242880 chars | Stamp task | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN | |
contextStack | string | ~ 32768 chars | Context of request |
Result
Type | Description | |
---|---|---|
contextStack | string | Request of context reflecting task execution results |
result | string | Response content |
getStampSheetResult
getStampSheetResult
///////////////////////////////////////////////////////////////
// New Experience (Enabled UniTask)
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
#if GS2_ENABLE_UNITASK
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
#endif
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
await profile.InitializeAsync();
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).StampSheetResult(
transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
);
var item = await domain.ModelAsync();
}
///////////////////////////////////////////////////////////////
// New Experience
///////////////////////////////////////////////////////////////
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
var future = profile.Initialize();
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var gs2 = new Gs2.Unity.Core.Gs2Domain(profile);
// Up to this line is the initialization process.
{
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).StampSheetResult(
transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
);
var future = domain.Model();
yield return future;
var item = future.Result;
}
///////////////////////////////////////////////////////////////
// Legacy Experience
///////////////////////////////////////////////////////////////
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;
var profile = new Profile(
clientId: "your client id",
clientSecret: "your client secret",
reopener: new Gs2BasicReopener()
);
{
AsyncResult<object> asyncResult = null;
var current = profile.Initialize(
r => { asyncResult = r; }
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
}
var gs2 = new Gs2.Unity.Client(profile);
// Up to this line is the initialization process.
{
AsyncResult<EzGetStampSheetResultResult> asyncResult = null;
var current = gs2.Distributor.GetStampSheetResult(
callback: r => { asyncResult = r; },
session: session,
namespaceName: "namespace-0001",
transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
);
yield return current;
if (asyncResult.Error != null)
{
OnError(asyncResult.Error);
yield break;
}
var result = asyncResult.Result;
var item = result.Item;
}
const auto Profile = MakeShared<Gs2::UE5::Util::FProfile>(
"your client id",
"your client secret",
Gs2::Core::Model::ERegion::ApNorthEast1,
MakeShareable<Gs2::UE5::Util::IReOpener>(new Gs2::UE5::Util::FGs2BasicReOpener())
);
Gs2::UE5::Core::Domain::FGs2DomainPtr Gs2;
{
const auto Future = Profile->Initialize();
Future->StartSynchronousTask();
if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;
Gs2 = Future->GetTask().Result();
Future->EnsureCompletion();
}
// Up to this line is the initialization process.
{
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->StampSheetResult(
"cc1985c3-54f0-4fc3-b295-dc30214284ec" // transactionId
);
const auto item = Domain.Model();
}
ProfilePtr = std::make_shared<gs2::ez::Profile>(
TCHAR_TO_ANSI(*ClientId),
TCHAR_TO_ANSI(*ClientSecret),
gs2::ez::Gs2BasicReopener()
);
ClientPtr = std::make_shared<gs2::ez::Client>(
*ProfilePtr
);
ProfilePtr->initialize(
[this](gs2::ez::Profile::AsyncInitializeResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
}
else
{
AccountCreate();
}
}
);
// Up to this line is the initialization process.
ClientPtr->distributor.getStampSheetResult(
[](gs2::ez::account::AsyncEzGetStampSheetResultResult r)
{
if (r.getError())
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "distributor.getStampSheetResult failed.");
}
else
{
Item = r.getResult()->getItem();
}
},
ProfilePtr->getGs2Session(),
TCHAR_TO_ANSI("namespace-0001"), // namespaceName
TCHAR_TO_ANSI("cc1985c3-54f0-4fc3-b295-dc30214284ec") // transactionId
);
Get stamp sheet execution results
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
transactionId | string | ✓ | 36 ~ 36 chars | stamp-sheet transaction ID |
Result
Type | Description | |
---|---|---|
item | EzStampSheetResult | Stamp sheet execution results |