GS2-Distributor SDK for Game Engine API リファレンス
モデル
EzConfig
コンフィグ設定
トランザクションの変数に適用する設定値
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| key | string | ✓ | ~ 64文字 | 名前 | ||
| value | string | ~ 51200文字 | 値 | 
関連するメソッド
EzDistributorModel
配信設定モデル
配信設定とはエンティティの入手時に所持枠を超えて入手した時のポリシーを設定するエンティティです。
GS2-Distributor を通して入手処理を行うことで、あふれたリソースを GS2-Inbox のメッセージとして転送することができます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | 配信設定名 | ||
| metadata | string | ~ 2048文字 | メタデータ | |||
| inboxNamespaceId | string | ~ 1024文字 | あふれたリソースを転送する GS2-Inbox のネームスペースGRN | |||
| whiteListTargetIds | List<string> | [] | 0 ~ 1000 items | ディストリビューターを通して処理出来る対象のリソースGRNのホワイトリスト | 
関連するメソッド
EzDistributeResource
リソース配布
EzStampSheetResult
トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | ||
| taskRequests | List<EzConsumeAction> | 0 ~ 100 items | 消費アクションのリクエスト内容 | |||
| sheetRequest | EzAcquireAction | ✓ | 入手アクションのリクエスト内容 | |||
| taskResults | List<string> | [] | 0 ~ 100 items | 消費アクションの実行結果 | ||
| sheetResult | string | ~ 1048576文字 | 入手アクションの実行結果レスポンス内容 | 
関連するメソッド
EzBatchRequestPayload
API一括実行リクエスト
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| requestId | string | ✓ | ~ 128文字 | リクエストID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| service | 文字列列挙型 enum { “account”, “adReward”, “auth”, “buff”, “chat”, “datastore”, “deploy”, “dictionary”, “distributor”, “enchant”, “enhance”, “exchange”, “experience”, “formation”, “friend”, “gateway”, “grade”, “guard”, “guild”, “identifier”, “idle”, “inbox”, “inventory”, “jobQueue”, “key”, “limit”, “lock”, “log”, “loginReward”, “lottery”, “matchmaking”, “megaField”, “mission”, “money”, “money2”, “news”, “quest”, “ranking”, “ranking2”, “realtime”, “schedule”, “script”, “seasonRating”, “serialKey”, “showcase”, “skillTree”, “stamina”, “stateMachine”, “version” } | ✓ | ~ 128文字 | マイクロサービス名 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| methodName | string | ✓ | ~ 128文字 | メソッド名 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parameter | string | ✓ | ~ 10240文字 | メソッド名 | 
関連するメソッド
EzBatchResultPayload
API一括実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| requestId | string | ✓ | ~ 128文字 | リクエストID | ||
| statusCode | int | ✓ | 100 ~ 1000 | ステータスコード | ||
| resultPayload | string | ✓ | ~ 10240文字 | レスポンス | 
関連するメソッド
EzAcquireAction
入手アクション
関連するモデル
EzConsumeAction
消費アクション
関連するモデル
EzVerifyAction
検証アクション
EzTransactionResult
トランザクション実行結果
サーバーサイドでのトランザクションの自動実行機能を利用して実行されたトランザクションの実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | ||
| verifyResults | List<EzVerifyActionResult> | 0 ~ 100 items | 検証アクションの実行結果リスト | |||
| consumeResults | List<EzConsumeActionResult> | 0 ~ 100 items | 消費アクションの実行結果リスト | |||
| acquireResults | List<EzAcquireActionResult> | 0 ~ 100 items | 入手アクションの実行結果リスト | 
関連するメソッド
EzAcquireActionResult
入手アクションの実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| acquireRequest | string | ✓ | ~ 524288文字 | リクエストのJSON | ||
| statusCode | int | 0 ~ 999 | ステータスコード | |||
| acquireResult | string | ~ 1048576文字 | 結果内容 | 
関連するモデル
EzConsumeActionResult
消費アクションの実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| consumeRequest | string | ✓ | ~ 524288文字 | リクエストのJSON | ||
| statusCode | int | 0 ~ 999 | ステータスコード | |||
| consumeResult | string | ~ 1048576文字 | 結果内容 | 
関連するモデル
EzVerifyActionResult
検証アクションの実行結果
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| verifyRequest | string | ✓ | ~ 524288文字 | リクエストのJSON | ||
| statusCode | int | 0 ~ 999 | ステータスコード | |||
| verifyResult | string | ~ 1048576文字 | 結果内容 | 
関連するモデル
メソッド
getDistributorModel
配信設定を取得
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| distributorName | string | ✓ | ~ 128文字 | 配信設定名 | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzDistributorModel | 配信設定 | 
実装例
    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.ModelFuture();
    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;
    }値の変更イベントハンドリング
    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).DistributorModel(
        distributorName: "distributor-model-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).DistributorModel(
        distributorName: "distributor-model-0001"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Distributor->Namespace(
        "namespace-0001" // namespaceName
    )->DistributorModel(
        "distributor-model-0001" // distributorName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Distributor::Model::FDistributorModel> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
listDistributorModels
配信設定の一覧を取得
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | 
Result
| 型 | 説明 | |
|---|---|---|
| items | List<EzDistributorModel> | 配信設定のリスト | 
実装例
    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());
    }値の変更イベントハンドリング
    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeDistributorModels(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );
    // イベントハンドリングを停止
    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
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->SubscribeDistributorModels(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );
    // イベントハンドリングを停止
    Domain->UnsubscribeDistributorModels(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
batchExecuteApi
API を一括実行
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| requestPayloads | List<EzBatchRequestPayload> | ✓ | 1 ~ 100 items | バッチリクエスト | 
Result
| 型 | 説明 | |
|---|---|---|
| results | List<EzBatchResultPayload> | バッチリザルト | 
実装例
    var domain = gs2.Distributor.Namespace(
        namespaceName: null
    );
    var result = await domain.BatchExecuteApiAsync(
        requestPayloads: new List<Gs2.Unity.Gs2Distributor.Model.EzBatchRequestPayload> {
            new Gs2.Unity.Gs2Distributor.Model.EzBatchRequestPayload() {
                Service = "inventory",
                Method = "describeSimpleItems",
                Request = "{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}",
            },
            new Gs2.Unity.Gs2Distributor.Model.EzBatchRequestPayload() {
                Service = "exchange",
                Method = "describeRateModels",
                Request = "{\"namespaceName\": \"namespace-0001\"}",
            },
        }
    );
    var results = result.Results;    var domain = gs2.Distributor.Namespace(
        namespaceName: null
    );
    var future = domain.BatchExecuteApiFuture(
        requestPayloads: new List<Gs2.Unity.Gs2Distributor.Model.EzBatchRequestPayload> {
            new Gs2.Unity.Gs2Distributor.Model.EzBatchRequestPayload() {
                Service = "inventory",
                Method = "describeSimpleItems",
                Request = "{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}",
            },
            new Gs2.Unity.Gs2Distributor.Model.EzBatchRequestPayload() {
                Service = "exchange",
                Method = "describeRateModels",
                Request = "{\"namespaceName\": \"namespace-0001\"}",
            },
        }
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var results = future.Result.Results;    const auto Domain = Gs2->Distributor->Namespace(
        nullptr // namespaceName
    );
    const auto Future = Domain->BatchExecuteApi(
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Distributor::Model::FEzBatchRequestPayload>>>();
            v->Add(
                MakeShared<Gs2::UE5::Distributor::Model::FEzBatchRequestPayload>()
                ->WithService(TOptional<FString>("inventory"))
                ->WithMethod(TOptional<FString>("describeSimpleItems"))
                ->WithRequest(TOptional<FString>("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"))
            );
            v->Add(
                MakeShared<Gs2::UE5::Distributor::Model::FEzBatchRequestPayload>()
                ->WithService(TOptional<FString>("exchange"))
                ->WithMethod(TOptional<FString>("describeRateModels"))
                ->WithRequest(TOptional<FString>("{\"namespaceName\": \"namespace-0001\"}"))
            );
            return v;
        }() // requestPayloads
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();
    const auto Results = Result->Results;freezeMasterData
マスターデータをこのAPIを呼び出した時点での内容で固定化するための情報を保持した Context Stack を発行します。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | 
Result
| 型 | 説明 | |
|---|---|---|
| newContextStack | string | マスターデータを固定する時刻を記録したコンテキスト | 
実装例
    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();freezeMasterDataBySignedTimestamp
マスターデータを署名付きのタイムスタンプ時点での内容で固定化するための情報を保持した Context Stack を発行します。
署名付きタイムスタンプは SignFreezeMasterDataTimestamp で発行することが可能です。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| body | string | ✓ | ~ 1024文字 | ボディ | ||
| signature | string | ✓ | ~ 256文字 | 署名 | ||
| keyId | string | ✓ | ~ 1024文字 | 署名計算に使用した GS2-Key の暗号鍵GRN | 
Result
| 型 | 説明 | |
|---|---|---|
| newContextStack | string | マスターデータを固定する時刻を記録したコンテキスト | 
実装例
    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Distribute(
    );
    var result = await domain.FreezeMasterDataBySignedTimestampAsync(
        accessToken: ,
        body: "body",
        signature: "signature",
        keyId: "key-0001"
    );    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Distribute(
    );
    var future = domain.FreezeMasterDataBySignedTimestampFuture(
        accessToken: ,
        body: "body",
        signature: "signature",
        keyId: "key-0001"
    );
    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->FreezeMasterDataBySignedTimestamp(
        , // accessToken
        "body", // body
        "signature", // signature
        "key-0001" // keyId
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();runStampSheet
入手アクションを実行
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | ||
| contextStack | string | ~ 32768文字 | リクエストコンテキスト | 
Result
| 型 | 説明 | |
|---|---|---|
| statusCode | int | ステータスコード | 
| result | string | レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runStampSheetExpress
トランザクションの検証アクション・消費アクション・入手アクションを一括実行
一括実行をすることで、レスポンスタイムを短縮できます。
エラーが発生した場合、再度APIを呼び出してください。成功するまで呼び出すことはクライアントでの責任となります。
リトライ時に ConsumeAction が複数回実行されないよう重複実行排除の仕組みがあるため、再実行してもリソースが重複して消費されることはありません。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | 
Result
| 型 | 説明 | |
|---|---|---|
| verifyTaskResultCodes | List<int> | 検証アクションの実行ステータスコード | 
| verifyTaskResults | List<string> | 検証アクションの実行結果 | 
| taskResultCodes | List<int> | 消費アクションの実行ステータスコード | 
| taskResults | List<string> | 消費アクションの実行結果 | 
| sheetResultCode | int | 入手アクションの実行ステータスコード | 
| sheetResult | string | 入手アクションの実行結果レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runStampSheetExpressWithoutNamespace
トランザクションの検証アクション・消費アクション・入手アクションを一括実行
一括実行をすることで、レスポンスタイムを短縮できます。
エラーが発生した場合、再度APIを呼び出してください。成功するまで呼び出すことはクライアントでの責任となります。
リトライ時に ConsumeAction が複数回実行されないよう重複実行排除の仕組みがあるため、再実行してもリソースが重複して消費されることはありません。
ネームスペースの指定を省略することで、
ログが記録できない・リソース溢れ処理が実行されないなどの副作用があります。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | 
Result
| 型 | 説明 | |
|---|---|---|
| verifyTaskResultCodes | List<int> | 検証アクションの実行ステータスコード | 
| verifyTaskResults | List<string> | 検証アクションの実行結果 | 
| taskResultCodes | List<int> | 消費アクションの実行ステータスコード | 
| taskResults | List<string> | 消費アクションの実行結果 | 
| sheetResultCode | int | 入手アクションの実行ステータスコード | 
| sheetResult | string | 入手アクションの実行結果レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runStampSheetWithoutNamespace
ネームスペースを指定せずに入手アクションを実行
ネームスペースの指定を省略することで、
ログが記録できない・リソース溢れ処理が実行されないなどの副作用があります。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| stampSheet | string | ✓ | ~ 5242880文字 | トランザクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | ||
| contextStack | string | ~ 32768文字 | リクエストコンテキスト | 
Result
| 型 | 説明 | |
|---|---|---|
| statusCode | int | ステータスコード | 
| result | string | レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runStampTask
消費アクションを実行
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| stampTask | string | ✓ | ~ 5242880文字 | 消費アクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | ||
| contextStack | string | ~ 32768文字 | リクエストコンテキスト | 
Result
| 型 | 説明 | |
|---|---|---|
| contextStack | string | タスクの実行結果を反映したコンテキストスタック | 
| statusCode | int | ステータスコード | 
| result | string | レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runStampTaskWithoutNamespace
ネームスペースを指定せずに消費アクションを実行
ネームスペースの指定を省略することで、
ログが記録できない・リソース溢れ処理が実行されないなどの副作用があります。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| stampTask | string | ✓ | ~ 5242880文字 | 消費アクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | ||
| contextStack | string | ~ 32768文字 | リクエストコンテキスト | 
Result
| 型 | 説明 | |
|---|---|---|
| contextStack | string | タスクの実行結果を反映したコンテキストスタック | 
| statusCode | int | ステータスコード | 
| result | string | レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runVerifyTask
消費アクションを実行
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| verifyTask | string | ✓ | ~ 5242880文字 | 検証アクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | ||
| contextStack | string | ~ 32768文字 | リクエストコンテキスト | 
Result
| 型 | 説明 | |
|---|---|---|
| contextStack | string | タスクの実行結果を反映したコンテキストスタック | 
| statusCode | int | ステータスコード | 
| result | string | レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
runVerifyTaskWithoutNamespace
ネームスペースを指定せずに検証アクションを実行
ネームスペースの指定を省略することで、
ログが記録できない・リソース溢れ処理が実行されないなどの副作用があります。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| verifyTask | string | ✓ | ~ 5242880文字 | 検証アクション | ||
| keyId | string | ✓ | ~ 1024文字 | 暗号鍵GRN | ||
| contextStack | string | ~ 32768文字 | リクエストコンテキスト | 
Result
| 型 | 説明 | |
|---|---|---|
| contextStack | string | タスクの実行結果を反映したコンテキストスタック | 
| statusCode | int | ステータスコード | 
| result | string | レスポンス内容 | 
実装例
// 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// SDKレベルで実行されるため明示的にAPIを呼び出す必要はありません
setDefaultConfig
トランザクション発行APIに指定する Config の値のデフォルト値を保持した Context Stack を発行します。
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| config | List<EzConfig> | ✓ | 1 ~ 1000 items | トランザクションのプレースホルダの適用する設定値 | 
Result
| 型 | 説明 | |
|---|---|---|
| newContextStack | string | デフォルトコンフィグを反映するためのコンテキストスタック | 
実装例
    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
トランザクションの実行結果を取得
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzStampSheetResult | トランザクションの実行結果 | 
実装例
    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.ModelFuture();
    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;
    }値の変更イベントハンドリング
    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).StampSheetResult(
        transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).StampSheetResult(
        transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
    );
    var future = domain.ModelFuture();
    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 CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Distributor::Model::FStampSheetResult> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
getTransactionResult
トランザクションの実行結果を取得
Request
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| accessToken | string | ✓ | ~ 128文字 | アクセストークン | ||
| transactionId | string | ✓ | 36 ~ 36文字 | トランザクションID | 
Result
| 型 | 説明 | |
|---|---|---|
| item | EzTransactionResult | トランザクションの実行結果 | 
実装例
    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).TransactionResult(
        transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
    );
    var item = await domain.ModelAsync();    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).TransactionResult(
        transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Distributor->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->TransactionResult(
        "cc1985c3-54f0-4fc3-b295-dc30214284ec" // transactionId
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }値の変更イベントハンドリング
    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).TransactionResult(
        transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);    var domain = gs2.Distributor.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).TransactionResult(
        transactionId: "cc1985c3-54f0-4fc3-b295-dc30214284ec"
    );
    var future = domain.ModelFuture();
    yield return future;
    var item = future.Result;    const auto Domain = Gs2->Distributor->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->TransactionResult(
        "cc1985c3-54f0-4fc3-b295-dc30214284ec" // transactionId
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Distributor::Model::FTransactionResult> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );
    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);Warning
このイベントはSDKがもつローカルキャッシュの値が変更された時に呼び出されます。
ローカルキャッシュは SDK が持つ API の実行、または GS2-Gateway の通知を有効にした GS2-Distributor 経由でのスタンプシートの実行、または GS2-Gateway の通知を有効にした GS2-JobQueue の実行によって変化したもののみが対象となります。
そのため、これらの方法以外で値が変更されてもコールバックは呼び出されません。
イベントハンドラ
OnAutoRunStampSheetNotification
トランザクションの自動実行が完了した際に通知
| 名前 | 型 | 説明 | 
|---|---|---|
| namespaceName | string | ネームスペース名 | 
| userId | string | ユーザーID | 
| transactionId | string | トランザクションID | 
実装例
    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;
    });OnAutoRunTransactionNotification
トランザクションの自動実行が完了した際に通知
| 名前 | 型 | 説明 | 
|---|---|---|
| namespaceName | string | ネームスペース名 | 
| userId | string | ユーザーID | 
| transactionId | string | トランザクションID | 
実装例
    gs2.Distributor.OnAutoRunTransactionNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var transactionId = notification.TransactionId;
    };    gs2.Distributor.OnAutoRunTransactionNotification += notification =>
    {
        var namespaceName = notification.NamespaceName;
        var userId = notification.UserId;
        var transactionId = notification.TransactionId;
    };    Gs2->Distributor->OnAutoRunTransactionNotification().AddLambda([](const auto Notification)
    {
        const auto NamespaceName = Notification->NamespaceNameValue;
        const auto UserId = Notification->UserIdValue;
        const auto TransactionId = Notification->TransactionIdValue;
    });