API Reference of GS2-Distributor SDK for Game Engine
Model
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 | Namespace GRN | ||
whiteListTargetIds | List<string> | [] | ~ 1000 items | Whitelist of target resource GRNs that can be processed through the distributor |
EzDistributeResource
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum [] | ✓ | ~ 128 chars | Types of actions to be performed in the stamp sheet | |
request | string | ✓ | ~ 1048576 chars | JSON of request |
EzStampSheetResult
Stamp sheet execution results
Stamp sheet execution results executed using server-side stamp sheet auto-execution functionality
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
transactionId | string | ✓ | 36 ~ 36 chars | stamp-sheet transaction ID | |
taskRequests | List<EzConsumeAction> | ~ 1000 items | List of Stamp task request payload | ||
sheetRequest | EzAcquireAction | ✓ | Stamp sheet request payload | ||
taskResults | List<string> | ~ 1000 items | Stamp task execution results | ||
sheetResult | string | ~ 1048576 chars | Stamp sheet execution result response content |
EzAcquireAction
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum [] | ✓ | ~ 128 chars | Types of actions to be performed in the stamp sheet | |
request | string | ✓ | ~ 1048576 chars | JSON of request |
EzConsumeAction
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
action | enum [] | ✓ | ~ 128 chars | Types of actions to be performed in the stamp task | |
request | string | ✓ | ~ 1048576 chars | JSON of the obtain request |
Methods
getDistributorModel
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 |
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 | ✓ | ~ 32 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(
);
for (auto Item : *It)
{
}
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.
runStampSheet
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 |
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 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 |
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 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 |
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 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 |
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 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 |
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 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 |
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
getStampSheetResult
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 |
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(
AccessToken
)->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(
AccessToken
)->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 stamp sheet auto-execution is complete
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
transactionId | string | stamp-sheet transaction ID |
Implementation Example
gs2.Distributor.OnAutoRunStampSheetNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var transactionId = notification.TransactionId;
};
gs2.Distributor.OnAutoRunStampSheetNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var transactionId = notification.TransactionId;
};
Gs2->Distributor->OnAutoRunStampSheetNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto TransactionId = Notification->TransactionIdValue;
});