API Reference of GS2-Distributor SDK for Game Engine
Model
EzConfig
Configration
Set values to be applied to transaction variables
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
key | string | ✓ | ~ 64 chars | Name | |
value | string | ~ 51200 chars | Value |
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 | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Delivery setting name | |
metadata | string | ~ 2048 chars | metadata | ||
inboxNamespaceId | string | ~ 1024 chars | GS2-Inbox namespace GRN to transfer overflow resources | ||
whiteListTargetIds | List<string> | [] | ~ 1000 items | Whitelist of target resource GRNs that can be processed through the distributor |
EzDistributeResource
Distribute Resource
EzStampSheetResult
Transaction execution results
Transaction execution results executed using server-side transaction auto-execution functionality
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID | |
taskRequests | List<EzConsumeAction> | ~ 10 items | List of consume action request payload | ||
sheetRequest | EzAcquireAction | ✓ | Acquire action request payload | ||
taskResults | List<string> | ~ 10 items | Consume action execution results | ||
sheetResult | string | ~ 1048576 chars | Acquire action execution results |
EzAcquireAction
Acquire Action
EzConsumeAction
Consume Action
EzVerifyAction
Verify Action
Methods
getDistributorModel
Get delivery settings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
distributorName | string | ✓ | ~ 128 chars | Delivery setting name |
Result
Type | Description | |
---|---|---|
item | EzDistributorModel | Delivery Setting |
Implementation Example
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).DistributorModel(
distributorName: "distributor-model-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).DistributorModel(
distributorName: "distributor-model-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->DistributorModel(
"distributor-model-0001" // distributorName
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).DistributorModel(
distributorName: "distributor-model-0001"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).DistributorModel(
distributorName: "distributor-model-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->DistributorModel(
"distributor-model-0001" // distributorName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Distributor::Model::FDistributorModel> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
listDistributorModels
Get list of delivery settings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzDistributorModel> | List of delivery settings |
Implementation Example
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.DistributorModelsAsync(
).ToListAsync();
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;
}
}
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->DistributorModels(
);
TArray<Gs2::UE5::Distributor::Model::FEzDistributorModelPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
Value change event handling
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeDistributorModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeDistributorModels(callbackId);
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;
}
}
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeDistributorModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeDistributorModels(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
freezeMasterData
Issue a Context Stack that holds the information to fix the contents at the time of calling this API in the Master Data.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
newContextStack | string | Request of context in time to freeze the master data |
Implementation Example
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).Distribute(
);
var result = await domain.FreezeMasterDataAsync(
accessToken:
);
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).Distribute(
);
var future = domain.FreezeMasterDataFuture(
accessToken:
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->Distribute(
);
const auto Future = Domain->FreezeMasterData(
// accessToken
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
runStampSheet
Run acquire action
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN | |
contextStack | string | ~ 32768 chars | Context of request |
Result
Type | Description | |
---|---|---|
statusCode | int | Status code |
result | string | Response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runStampSheetExpress
Batch execution of verify actions, consume actions, and acquire actions in transactions
Batch execution reduces response time. However, there is no guarantee of a correct retry in the event of failure in the process of transaction execution. It is strongly recommended to keep a log of transaction 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 | ✓ | ~ 128 chars | Namespace name | |
stampSheet | string | ✓ | ~ 5242880 chars | Transaction | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
verifyTaskResultCodes | List<int> | Verify action execution status code |
verifyTaskResults | List<string> | Verify action execution results |
taskResultCodes | List<int> | Consume action execution status code |
taskResults | List<string> | Consume action execution results |
sheetResultCode | int | Acquire action execution status code |
sheetResult | string | Acquire action execution result response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runStampSheetExpressWithoutNamespace
Batch execution of verify actions, consume actions, and acquire actions in transactions
Batch execution reduces response time. However, there is no guarantee of a correct retry in the event of failure in the process of transaction execution. It is strongly recommended to keep a log of transaction 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 | Transaction | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
verifyTaskResultCodes | List<int> | Verify action execution status code |
verifyTaskResults | List<string> | Verify action execution results |
taskResultCodes | List<int> | Consume action execution status code |
taskResults | List<string> | Consume action execution results |
sheetResultCode | int | Acquire action execution status code |
sheetResult | string | Acquire action execution result response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runStampSheetWithoutNamespace
Run acquire action without specifying namespace
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 | Transaction | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN | |
contextStack | string | ~ 32768 chars | Context of request |
Result
Type | Description | |
---|---|---|
statusCode | int | Status code |
result | string | Response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runStampTask
Run consume action
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
stampTask | string | ✓ | ~ 5242880 chars | Consume Action | |
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 |
statusCode | int | Status code |
result | string | Response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runStampTaskWithoutNamespace
Run consume action without specifying namespace
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 | Consume Action | |
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 |
statusCode | int | Status code |
result | string | Response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runVerifyTask
Run verify action
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
verifyTask | string | ✓ | ~ 5242880 chars | Verify Action | |
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 |
statusCode | int | Status code |
result | string | Response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
runVerifyTaskWithoutNamespace
Run verify action without specifying namespace
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 | |
---|---|---|---|---|---|
verifyTask | string | ✓ | ~ 5242880 chars | Verify Action | |
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 |
statusCode | int | Status code |
result | string | Response content |
Implementation Example
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// New Experience ではSDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
// New Experience runs at the SDK level, so there is no need to explicitly call the API
// Runs at the SDK level, so there is no need to explicitly call the API
setDefaultConfig
Issue a Context Stack that holds the default values of Config to be specified in the Transaction Issuance API.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
accessToken | string | ✓ | ~ 128 chars | User Id | |
config | List<EzConfig> | ✓ | 1 ~ 1000 items | Transaction placeholder applied settings values |
Result
Type | Description | |
---|---|---|
newContextStack | string | Context stack reflecting the results of the task |
Implementation Example
var domain = gs2.Distributor.Namespace(
namespaceName: null
);
var result = await domain.SetDefaultConfigAsync(
accessToken: ,
config: new List<Gs2.Unity.Gs2Distributor.Model.EzConfig> {
new Gs2.Unity.Gs2Distributor.Model.EzConfig() {
Key = "key-0001",
Value = "value-0001",
},
new Gs2.Unity.Gs2Distributor.Model.EzConfig() {
Key = "key-0002",
Value = "value-0002",
},
}
);
var domain = gs2.Distributor.Namespace(
namespaceName: null
);
var future = domain.SetDefaultConfigFuture(
accessToken: ,
config: new List<Gs2.Unity.Gs2Distributor.Model.EzConfig> {
new Gs2.Unity.Gs2Distributor.Model.EzConfig() {
Key = "key-0001",
Value = "value-0001",
},
new Gs2.Unity.Gs2Distributor.Model.EzConfig() {
Key = "key-0002",
Value = "value-0002",
},
}
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Distributor->Namespace(
nullptr // namespaceName
);
const auto Future = Domain->SetDefaultConfig(
, // accessToken
[]
{
auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Distributor::Model::FEzConfig>>>();
v->Add(
MakeShared<Gs2::UE5::Distributor::Model::FEzConfig>()
->WithKey(TOptional<FString>("key-0001"))
->WithValue(TOptional<FString>("value-0001"))
);
v->Add(
MakeShared<Gs2::UE5::Distributor::Model::FEzConfig>()
->WithKey(TOptional<FString>("key-0002"))
->WithValue(TOptional<FString>("value-0002"))
);
return v;
}() // config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
getStampSheetResult
Get transaction execution results
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID |
Result
Type | Description | |
---|---|---|
item | EzStampSheetResult | Transaction execution results |
Implementation Example
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).StampSheetResult(
transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
);
var item = await domain.ModelAsync();
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;
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->StampSheetResult(
"cc1985c3-54f0-4fc3-b295-dc30214284ec" // transactionId
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Distributor.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).StampSheetResult(
transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
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;
const auto Domain = Gs2->Distributor->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->StampSheetResult(
"cc1985c3-54f0-4fc3-b295-dc30214284ec" // transactionId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Distributor::Model::FStampSheetResult> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
Event Handler
OnAutoRunStampSheetNotification
Notification when transaction auto-execution is complete
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
transactionId | string | Transaction ID |
Implementation Example
gs2.Distributor.OnAutoRunStampSheetNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var transactionId = notification.TransactionId;
};
gs2.Distributor.OnAutoRunStampSheetNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var transactionId = notification.TransactionId;
};
Gs2->Distributor->OnAutoRunStampSheetNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto TransactionId = Notification->TransactionIdValue;
});