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.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsDelivery setting name
metadatastring~ 2048 charsmetadata
inboxNamespaceIdstring~ 1024 charsNamespace GRN
whiteListTargetIdsList<string>[]~ 1000 itemsWhitelist of target resource GRNs that can be processed through the distributor

EzDistributeResource

TypeRequireDefaultLimitationDescription
actionenum []~ 128 charsTypes of actions to be performed in the stamp sheet
requeststring~ 1048576 charsJSON of request

EzStampSheetResult

Stamp sheet execution results

Stamp sheet execution results executed using server-side stamp sheet auto-execution functionality

TypeRequireDefaultLimitationDescription
transactionIdstring36 ~ 36 charsstamp-sheet transaction ID
taskRequestsList<EzConsumeAction>~ 1000 itemsList of Stamp task request payload
sheetRequestEzAcquireActionStamp sheet request payload
taskResultsList<string>~ 1000 itemsStamp task execution results
sheetResultstring~ 1048576 charsStamp sheet execution result response content

EzAcquireAction

TypeRequireDefaultLimitationDescription
actionenum []~ 128 charsTypes of actions to be performed in the stamp sheet
requeststring~ 1048576 charsJSON of request

EzConsumeAction

TypeRequireDefaultLimitationDescription
actionenum []~ 128 charsTypes of actions to be performed in the stamp task
requeststring~ 1048576 charsJSON of the obtain request

Methods

getDistributorModel

Get delivery settings

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
distributorNamestring~ 128 charsDelivery setting name

Result

TypeDescription
itemEzDistributorModelDelivery 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);

listDistributorModels

Get list of delivery settings

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

Result

TypeDescription
itemsList<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);

runStampSheet

Run Stamp Sheet

Request

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
stampSheetstring~ 5242880 charsStamp sheet
keyIdstring~ 1024 charsencryption key GRN
contextStackstring~ 32768 charsContext of request

Result

TypeDescription
resultstringResponse 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

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
stampSheetstring~ 5242880 charsStamp sheet
keyIdstring~ 1024 charsencryption key GRN

Result

TypeDescription
taskResultsList<string>Stamp task execution results
sheetResultstringStamp 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

TypeRequireDefaultLimitationDescription
stampSheetstring~ 5242880 charsStamp sheet
keyIdstring~ 1024 charsencryption key GRN

Result

TypeDescription
taskResultsList<string>Stamp task execution results
sheetResultstringStamp 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

TypeRequireDefaultLimitationDescription
stampSheetstring~ 5242880 charsStamp sheet
keyIdstring~ 1024 charsencryption key GRN
contextStackstring~ 32768 charsContext of request

Result

TypeDescription
resultstringResponse 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

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
stampTaskstring~ 5242880 charsStamp task
keyIdstring~ 1024 charsencryption key GRN
contextStackstring~ 32768 charsContext of request

Result

TypeDescription
contextStackstringRequest of context reflecting task execution results
resultstringResponse 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

TypeRequireDefaultLimitationDescription
stampTaskstring~ 5242880 charsStamp task
keyIdstring~ 1024 charsencryption key GRN
contextStackstring~ 32768 charsContext of request

Result

TypeDescription
contextStackstringRequest of context reflecting task execution results
resultstringResponse 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

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
accessTokenstring~ 128 charsUser Id
transactionIdstring36 ~ 36 charsstamp-sheet transaction ID

Result

TypeDescription
itemEzStampSheetResultStamp 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);

Event Handler

OnAutoRunStampSheetNotification

Notification when stamp sheet auto-execution is complete

NameTypeDescription
namespaceNamestringNamespace name
transactionIdstringstamp-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;
    });