GS2-Version SDK for Game Engine API リファレンス

モデル

EzVersion

バージョン

必須デフォルト値の制限説明
majorint~ 2147483646メジャーバージョン
minorint~ 2147483646マイナーバージョン
microint~ 2147483646マイクロバージョン

EzVersionModel

バージョンモデル

ログインを受け入れるが、バージョンアップ出来ることを通知する警告バージョンと、ログインを受け入れないエラーバージョンを設定できます。

現在のバージョンをクライアントに申告させるのに、署名の有無を指定できます。 署名付きを選択した場合、クライアントは嘘のバージョン申告を出来なくなります。

必須デフォルト値の制限説明
namestring~ 128文字バージョンモデル名
metadatastring~ 2048文字メタデータ
warningVersionEzVersion{type} == “simple”バージョンアップを促すバージョン
errorVersionEzVersion{type} == “simple”バージョンチェックでエラーになるバージョン
scopeenum [
“passive”,
“active”
]
~ 128文字判定に使用するバージョン値の種類
currentVersionEzVersion{type} == “simple” and {scope} == “active”現在のバージョン
needSignaturebool{scope} == “passive”判定するバージョン値に署名検証を必要とするか

EzAcceptVersion

承認したバージョン

アプリバージョンや、アセットバージョンのようなデータに紐づいたバージョンではなく 同意した利用規約のバージョンのようなユーザ毎にバージョン管理が必要なエンティティで使用します。

必須デフォルト値の制限説明
versionNamestring~ 128文字承認したバージョン名
userIdstring~ 128文字ユーザーID
versionEzVersion承認したバージョン

EzStatus

バージョンの状態

バージョンの検証結果を表します。

必須デフォルト値の制限説明
versionModelEzVersionModelバージョンモデル
currentVersionEzVersion現在のバージョン

EzTargetVersion

検証するバージョン

必須デフォルト値の制限説明
versionNamestring~ 128文字バージョンモデル名
versionEzVersion{signature} == ""バージョン
bodystring~ 1048576文字ボディ
signaturestring~ 256文字署名

メソッド

getVersionModel

バージョンモデルを取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
versionNamestring~ 128文字バージョンモデル名

Result

説明
itemEzVersionModelバージョンモデル

実装例

    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).VersionModel(
        versionName: "version-0001"
    );
    var item = await domain.ModelAsync();
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).VersionModel(
        versionName: "version-0001"
    );
    var future = domain.Model();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Version->Namespace(
        "namespace-0001" // namespaceName
    )->VersionModel(
        "version-0001" // versionName
    );
    const auto Future = Domain->Model();
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
値の変更イベントハンドリング
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).VersionModel(
        versionName: "version-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.Subscribe(
        value => {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    domain.Unsubscribe(callbackId);
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).VersionModel(
        versionName: "version-0001"
    );
    var future = domain.Model();
    yield return future;
    var item = future.Result;
    const auto Domain = Gs2->Version->Namespace(
        "namespace-0001" // namespaceName
    )->VersionModel(
        "version-0001" // versionName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->Subscribe(
        [](TSharedPtr<Gs2::Version::Model::FVersionModel> value) {
            // 値が変化した時に呼び出される
            // value には変更後の値が渡ってくる
        }
    );

    // イベントハンドリングを停止
    Domain->Unsubscribe(CallbackId);

listVersionModels

バージョンモデルの一覧を取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
itemsList<EzVersionModel>バージョンモデルのリスト

実装例

    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    );
    var items = await domain.VersionModelsAsync(
    ).ToListAsync();
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.VersionModels(
    );
    List<EzVersionModel> items = new List<EzVersionModel>();
    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->Version->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto It = Domain->VersionModels(
    );
    TArray<Gs2::UE5::Version::Model::FEzVersionModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
値の変更イベントハンドリング
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeVersionModels(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeVersionModels(callbackId);
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    );
    var it = domain.VersionModels(
    );
    List<EzVersionModel> items = new List<EzVersionModel>();
    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->Version->Namespace(
        "namespace-0001" // namespaceName
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->SubscribeVersionModels(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    Domain->UnsubscribeVersionModels(CallbackId);

accept

バージョンを承認する

利用規約などで使用します。

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
versionNamestring~ 128文字承認したバージョン名

Result

説明
itemEzAcceptVersion承認したバージョン

実装例

    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).AcceptVersion(
        versionName: "eula"
    );
    var result = await domain.AcceptAsync(
    );
    var item = await result.ModelAsync();
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).AcceptVersion(
        versionName: "eula"
    );
    var future = domain.AcceptFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var future2 = future.Result.Model();
    yield return future2;
    if (future2.Error != null)
    {
        onError.Invoke(future2.Error, null);
        yield break;
    }
    var result = future2.Result;
    const auto Domain = Gs2->Version->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->AcceptVersion(
        "eula" // versionName
    );
    const auto Future = Domain->Accept(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (Future2->GetTask().IsError())
    {
        return Future2->GetTask().Error();
    }
    const auto Result = Future2->GetTask().Result();

delete

承認したバージョンを削除する

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
versionNamestring~ 128文字承認したバージョン名

Result

説明
itemEzAcceptVersion削除した承認バージョン

実装例

    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).AcceptVersion(
        versionName: "eula"
    );
    var result = await domain.DeleteAsync(
    );
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).AcceptVersion(
        versionName: "eula"
    );
    var future = domain.DeleteFuture(
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    const auto Domain = Gs2->Version->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->AcceptVersion(
        "eula" // versionName
    );
    const auto Future = Domain->Delete(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();

list

承認したバージョンの一覧を取得

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<EzAcceptVersion>承認したバージョンのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var items = await domain.AcceptVersionsAsync(
    ).ToListAsync();
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.AcceptVersions(
    );
    List<EzAcceptVersion> items = new List<EzAcceptVersion>();
    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->Version->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    const auto It = Domain->AcceptVersions(
    );
    TArray<Gs2::UE5::Version::Model::FEzAcceptVersionPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }
値の変更イベントハンドリング
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    
    // イベントハンドリングを開始
    var callbackId = domain.SubscribeAcceptVersions(
        () => {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    domain.UnsubscribeAcceptVersions(callbackId);
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    );
    var it = domain.AcceptVersions(
    );
    List<EzAcceptVersion> items = new List<EzAcceptVersion>();
    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->Version->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    );
    
    // イベントハンドリングを開始
    const auto CallbackId = Domain->SubscribeAcceptVersions(
        []() {
            // リストの要素が変化した時に呼び出される
        }
    );

    // イベントハンドリングを停止
    Domain->UnsubscribeAcceptVersions(CallbackId);

checkVersion

バージョンチェックを実行

Request

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
accessTokenstring~ 128文字ユーザーID
targetVersionsList<EzTargetVersion>[]~ 1000 items検証するバージョンリスト

Result

説明
projectTokenstringサインインしたプロジェクトトークン
warningsList<EzStatus>バージョンの検証結果 警告のリスト
errorsList<EzStatus>バージョンの検証結果 エラーのリスト

実装例

    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Checker(
    );
    var result = await domain.CheckVersionAsync(
        targetVersions: new List<Gs2.Unity.Gs2Version.Model.EzTargetVersion> {
            new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                VersionName = "app",
                Version = 
                new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                    Major = 1,
                    Minor = 2,
                    Micro = 3,
                },
            },
            new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                VersionName = "asset",
                Version = 
                new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                    Major = 1,
                    Minor = 2,
                    Micro = 3,
                },
            },
        }
    );
    var projectToken = result.ProjectToken;
    var warnings = result.Warnings;
    var errors = result.Errors;
    var domain = gs2.Version.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Checker(
    );
    var future = domain.CheckVersionFuture(
        targetVersions: new List<Gs2.Unity.Gs2Version.Model.EzTargetVersion> {
            new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                VersionName = "app",
                Version = 
                new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                    Major = 1,
                    Minor = 2,
                    Micro = 3,
                },
            },
            new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                VersionName = "asset",
                Version = 
                new Gs2.Unity.Gs2Version.Model.EzTargetVersion() {
                    Major = 1,
                    Minor = 2,
                    Micro = 3,
                },
            },
        }
    );
    yield return future;
    if (future.Error != null)
    {
        onError.Invoke(future.Error, null);
        yield break;
    }
    var projectToken = future.Result.ProjectToken;
    var warnings = future.Result.Warnings;
    var errors = future.Result.Errors;
    const auto Domain = Gs2->Version->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        GameSession
    )->Checker(
    );
    const auto Future = Domain->CheckVersion(
        []
        {
            auto v = MakeShared<TArray<TSharedPtr<Gs2::UE5::Version::Model::FEzTargetVersion>>>();
            v->Add(
                MakeShared<Gs2::UE5::Version::Model::FEzTargetVersion>()
                ->WithVersionName(TOptional<FString>("app"))
                ->WithVersion(MakeShared<Gs2::UE5::Version::Model::FEzVersion>() 
                    ->WithMajor(TOptional<int32>(1))
                    ->WithMinor(TOptional<int32>(2))
                    ->WithMicro(TOptional<int32>(3))
                );
            );
            v->Add(
                MakeShared<Gs2::UE5::Version::Model::FEzTargetVersion>()
                ->WithVersionName(TOptional<FString>("asset"))
                ->WithVersion(MakeShared<Gs2::UE5::Version::Model::FEzVersion>() 
                    ->WithMajor(TOptional<int32>(1))
                    ->WithMinor(TOptional<int32>(2))
                    ->WithMicro(TOptional<int32>(3))
                );
            );
            return v;
        }() // targetVersions
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError())
    {
        return false;
    }
    const auto Result = Future->GetTask().Result();
    const auto ProjectToken = Result->ProjectToken;
    const auto Warnings = Result->Warnings;
    const auto Errors = Result->Errors;