NAV
Unity Unreal Engine 4

GS2-Datastore

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

ゲームエンジン向けSDKモデル

EzDataObject

データオブジェクトはゲームプレイヤーがアップロードしたデータです。 データは世代管理され、30日分の過去のデータも保管されます。

データにはアクセス権限を設定できます。 スコープには3種類あり、だれでもアクセスできる public。指定したユーザーIDのゲームプレイヤーのみがアクセスできる protected。自身のみがアクセスできる private があります。

説明
dataObjectId string データオブジェクトGRN
name string データの名前
userId string ユーザーID
scope string ファイルのアクセス権
allowUserIds string[] 公開するユーザIDリスト
status string 状態
generation string データの世代
createdAt long 作成日時
updatedAt long 最終更新日時

EzDataObjectHistory

説明
dataObjectHistoryId string データオブジェクト履歴GRN
generation string 世代ID
contentLength long データサイズ
createdAt long 作成日時

メソッド

deleteDataObject

deleteDataObject

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.deleteDataObject(
    [](gs2::ez::account::AsyncEzDeleteDataObjectResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.deleteDataObject failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("dataObject-0001") // dataObjectName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDeleteDataObjectResult> asyncResult = null;
    var current = gs2.Datastore.DeleteDataObject(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        dataObjectName: "dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

アップロードしたデータを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
dataObjectName string UUID ~ 36文字 データの名前

Result

説明
item DataObject データオブジェクト

doneUpload

doneUpload

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.doneUpload(
    [](gs2::ez::account::AsyncEzDoneUploadResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.doneUpload failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("dataObject-0001") // dataObjectName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDoneUploadResult> asyncResult = null;
    var current = gs2.Datastore.DoneUpload(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        dataObjectName: "dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

データのアップロード完了を報告

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
dataObjectName string UUID ~ 36文字 データの名前

Result

説明
item DataObject データオブジェクト

listMyDataObjects

listMyDataObjects

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.describeDataObjects(
    [](gs2::ez::account::AsyncEzDescribeDataObjectsResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.describeDataObjects failed.");
        }
        else
        {
            Items = r.getResult()->getItems();
            NextPageToken = r.getResult()->getNextPageToken();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    null // limit,
    TCHAR_TO_ANSI("ACTIVE"), // status
    TCHAR_TO_ANSI(null) // pageToken
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDescribeDataObjectsResult> asyncResult = null;
    var current = gs2.Datastore.DescribeDataObjects(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        limit: null,
        status: "ACTIVE",
        pageToken: null
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var items = result.Items;
    var nextPageToken = result.NextPageToken;
}

データオブジェクトの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
status string ~ 128文字 状態
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items DataObject[] データオブジェクトのリスト
nextPageToken string リストの続きを取得するためのページトークン

prepareDownload

prepareDownload

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.prepareDownload(
    [](gs2::ez::account::AsyncEzPrepareDownloadResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.prepareDownload failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
            FileUrl = r.getResult()->getFileUrl();
            ContentLength = r.getResult()->getContentLength();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("grn:dataObject-0001") // dataObjectId
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzPrepareDownloadResult> asyncResult = null;
    var current = gs2.Datastore.PrepareDownload(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        dataObjectId: "grn:dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var fileUrl = result.FileUrl;
    var contentLength = result.ContentLength;
}

データをダウンロード準備

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
dataObjectId string ~ 1024文字 データオブジェクトGRN
accessToken string ~ 128文字 ユーザーID

Result

説明
item DataObject データオブジェクト
fileUrl string ファイルをダウンロードするためのURL
contentLength long ファイルの容量

prepareDownloadByUserIdAndDataObjectName

prepareDownloadByUserIdAndDataObjectName

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.prepareDownloadByUserIdAndDataObjectName(
    [](gs2::ez::account::AsyncEzPrepareDownloadByUserIdAndDataObjectNameResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.prepareDownloadByUserIdAndDataObjectName failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
            FileUrl = r.getResult()->getFileUrl();
            ContentLength = r.getResult()->getContentLength();
        }
    },
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("user-0001"), // userId
    TCHAR_TO_ANSI("dataObject-0001") // dataObjectName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzPrepareDownloadByUserIdAndDataObjectNameResult> asyncResult = null;
    var current = gs2.Datastore.PrepareDownloadByUserIdAndDataObjectName(
        callback: r => { asyncResult = r; },
        namespaceName: "namespace2",
        userId: "user-0001",
        dataObjectName: "dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var fileUrl = result.FileUrl;
    var contentLength = result.ContentLength;
}

ユーザIDとデータ名を指定してデータをダウンロード準備

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
userId string ~ 128文字 ユーザーID
dataObjectName string UUID ~ 36文字 データの名前

Result

説明
item DataObject データオブジェクト
fileUrl string ファイルをダウンロードするためのURL
contentLength long ファイルの容量

prepareDownloadOwnData

prepareDownloadOwnData

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.prepareDownloadOwnData(
    [](gs2::ez::account::AsyncEzPrepareDownloadOwnDataResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.prepareDownloadOwnData failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
            FileUrl = r.getResult()->getFileUrl();
            ContentLength = r.getResult()->getContentLength();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("dataObject-0001") // dataObjectName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzPrepareDownloadOwnDataResult> asyncResult = null;
    var current = gs2.Datastore.PrepareDownloadOwnData(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        dataObjectName: "dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var fileUrl = result.FileUrl;
    var contentLength = result.ContentLength;
}

自分のデータをダウンロード準備

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
dataObjectName string UUID ~ 36文字 データの名前
accessToken string ~ 128文字 ユーザーID

Result

説明
item DataObject データオブジェクト
fileUrl string ファイルをダウンロードするためのURL
contentLength long ファイルの容量

prepareReUpload

prepareReUpload

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.prepareReUpload(
    [](gs2::ez::account::AsyncEzPrepareReUploadResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.prepareReUpload failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
            UploadUrl = r.getResult()->getUploadUrl();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("dataObject-0001") // dataObjectName
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzPrepareReUploadResult> asyncResult = null;
    var current = gs2.Datastore.PrepareReUpload(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        dataObjectName: "dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var uploadUrl = result.UploadUrl;
}

データの再アップロード準備

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
dataObjectName string UUID ~ 36文字 データの名前

Result

説明
item DataObject データオブジェクト
uploadUrl string アップロード処理の実行に使用するURL

prepareUpload

prepareUpload

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.prepareUpload(
    [](gs2::ez::account::AsyncEzPrepareUploadResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.prepareUpload failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
            UploadUrl = r.getResult()->getUploadUrl();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("public") // scope,
    TCHAR_TO_ANSI("dataObject-0001"), // name
    null, // allowUserIds
    null // updateIfExists
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzPrepareUploadResult> asyncResult = null;
    var current = gs2.Datastore.PrepareUpload(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        scope: "public",
        name: "dataObject-0001",
        allowUserIds: null,
        updateIfExists: null
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
    var uploadUrl = result.UploadUrl;
}

データのアップロード準備

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
name string ~ 128文字 データの名前
scope string "private" ~ 128文字 ファイルのアクセス権
allowUserIds string[] {scope} != none and {scope} == "protected" [] 公開するユーザIDリスト
updateIfExists bool false 既にデータが存在する場合にエラーとするか、データを更新するか

Result

説明
item DataObject データオブジェクト
uploadUrl string アップロード処理の実行に使用するURL

restoreDataObject

restoreDataObject

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.restoreDataObject(
    [](gs2::ez::account::AsyncEzRestoreDataObjectResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.restoreDataObject failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
        }
    },
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("grn:dataObject-0001") // dataObjectId
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzRestoreDataObjectResult> asyncResult = null;
    var current = gs2.Datastore.RestoreDataObject(
        callback: r => { asyncResult = r; },
        namespaceName: "namespace2",
        dataObjectId: "grn:dataObject-0001"
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

データの管理情報を修復

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
dataObjectId string ~ 1024文字 データオブジェクトGRN

Result

説明
item DataObject データオブジェクト

updateDataObject

updateDataObject

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.updateDataObject(
    [](gs2::ez::account::AsyncEzUpdateDataObjectResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.updateDataObject failed.");
        }
        else
        {
            Item = r.getResult()->getItem();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace2"), // namespaceName
    TCHAR_TO_ANSI("public") // scope,
    null // allowUserIds
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzUpdateDataObjectResult> asyncResult = null;
    var current = gs2.Datastore.UpdateDataObject(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace2",
        scope: "public",
        allowUserIds: null
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var item = result.Item;
}

データオブジェクトを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
scope string "private" ~ 128文字 ファイルのアクセス権
allowUserIds string[] {scope} != none and {scope} == "protected" [] 公開するユーザIDリスト

Result

説明
item DataObject データオブジェクト

listDataObjectHistories

listDataObjectHistories

ProfilePtr = std::make_shared<gs2::ez::Profile>(
    TCHAR_TO_ANSI(*ClientId),
    TCHAR_TO_ANSI(*ClientSecret),
    gs2::ez::Gs2BasicReopener()
);

ClientPtr = std::make_shared<gs2::ez::Client>(
    *ProfilePtr
);

ProfilePtr->initialize(
    [this](gs2::ez::Profile::AsyncInitializeResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "profile.initialize failed.");
        }
        else
        {
            AccountCreate();
        }
    }
);

// Up to this line is the initialization process.

ClientPtr->datastore.describeDataObjectHistories(
    [](gs2::ez::account::AsyncEzDescribeDataObjectHistoriesResult r)
    {
        if (r.getError())
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "datastore.describeDataObjectHistories failed.");
        }
        else
        {
            Items = r.getResult()->getItems();
            NextPageToken = r.getResult()->getNextPageToken();
        }
    },
    ProfilePtr->getGs2Session(),
    TCHAR_TO_ANSI("namespace1"), // namespaceName
    TCHAR_TO_ANSI("dataObject-0001"), // dataObjectName
    null // limit,
    TCHAR_TO_ANSI(null) // pageToken
);
using Gs2.Core.AsyncResult;
using Gs2.Gs2Account.Unity.Result;
using Gs2.Unity.Util;

var profile = new Profile(
    clientId: "your client id",
    clientSecret: "your client secret",
    reopener: new Gs2BasicReopener()
);

{
    AsyncResult<object> asyncResult = null;

    var current = profile.Initialize(
        r => { asyncResult = r; }
    );

    yield return current;

    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }
}

// Up to this line is the initialization process.

var gs2 = new Gs2.Unity.Client(profile);

{
    AsyncResult<EzDescribeDataObjectHistoriesResult> asyncResult = null;
    var current = gs2.Datastore.DescribeDataObjectHistories(
        callback: r => { asyncResult = r; },
        session: session,
        namespaceName: "namespace1",
        dataObjectName: "dataObject-0001",
        limit: null,
        pageToken: null
    );

    yield return current;
    if (asyncResult.Error != null)
    {
        OnError(asyncResult.Error);
        yield break;
    }

    var result = asyncResult.Result;
    var items = result.Items;
    var nextPageToken = result.NextPageToken;
}

データオブジェクト履歴の一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
accessToken string ~ 128文字 ユーザーID
dataObjectName string UUID ~ 36文字 データの名前
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items DataObjectHistory[] データオブジェクト履歴のリスト
nextPageToken string リストの続きを取得するためのページトークン