API Reference of GS2-Datastore SDK for Game Engine
Model
EzDataObject
Data Object
Data objects are data uploaded by game players.
Data is generation managed, with 30 days of historical data stored.
Access permissions can be set for the data.
There are three scopes: public, which can be accessed by anyone; protected, which can be accessed only by the game player with the specified user ID; and private, which can be accessed only by the game player himself.
| Type | Require | Default | Limitation | Description |
---|
dataObjectId | string | ✓ | | ~ 1024 chars | Data object GRN |
name | string | ✓ | UUID | ~ 128 chars | Data object Name |
userId | string | ✓ | | ~ 128 chars | User Id |
scope | enum [‘public’, ‘protected’, ‘private’] | ✓ | “private” | ~ 128 chars | File access permission |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published |
status | enum [‘ACTIVE’, ‘UPLOADING’, ‘DELETED’] | ✓ | | ~ 128 chars | Status |
generation | string | | | ~ 128 chars | Data Generation |
createdAt | long | ✓ | | | Datetime of creation |
updatedAt | long | ✓ | | | Datetime of last update |
EzDataObjectHistory
Data Object History
You can check the update history of data objects.
| Type | Require | Default | Limitation | Description |
---|
dataObjectHistoryId | string | ✓ | | ~ 1024 chars | History of Data object GRN |
generation | string | ✓ | | ~ 128 chars | Generations ID |
contentLength | long | ✓ | | ~ 10485760 | File size |
createdAt | long | ✓ | | | Datetime of creation |
Methods
deleteDataObject
Delete uploaded data
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name |
Result
Error
Special exceptions are defined in this API.
GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games.
Please refer to the documentation here for more information on common error types and handling methods.
Type | Base Type | Description |
---|
InvalidStatusException | BadRequestException | DataObject is not in operable state. |
Implementation Example
try {
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var result = await domain.DeleteDataObjectAsync(
);
var item = await result.ModelAsync();
} catch(Gs2.Gs2Datastore.Exception.InvalidStatus e) {
// DataObject is not in operable state.
}
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var future = domain.DeleteDataObjectFuture(
);
yield return future;
if (future.Error != null)
{
if (future.Error is Gs2.Gs2Datastore.Exception.InvalidStatusException)
{
// DataObject is not in operable state.
}
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto Future = Domain->DeleteDataObject(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
if (Gs2::Datastore::Error::FInvalidStatusError::TypeString == Task->GetTask().Error()->Type())
{
// DataObject is not in operable state.
}
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
doneUpload
Report completion of data upload
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name |
Result
Error
Special exceptions are defined in this API.
GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games.
Please refer to the documentation here for more information on common error types and handling methods.
Type | Base Type | Description |
---|
InvalidStatusException | BadRequestException | DataObject is not in operable state. |
NotUploadedException | BadRequestException | DataObject is not uploaded. |
Implementation Example
try {
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var result = await domain.DoneUploadAsync(
);
var item = await result.ModelAsync();
} catch(Gs2.Gs2Datastore.Exception.InvalidStatus e) {
// DataObject is not in operable state.
} catch(Gs2.Gs2Datastore.Exception.NotUploaded e) {
// DataObject is not uploaded.
}
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var future = domain.DoneUploadFuture(
);
yield return future;
if (future.Error != null)
{
if (future.Error is Gs2.Gs2Datastore.Exception.InvalidStatusException)
{
// DataObject is not in operable state.
}
if (future.Error is Gs2.Gs2Datastore.Exception.NotUploadedException)
{
// DataObject is not uploaded.
}
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto Future = Domain->DoneUpload(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
if (Gs2::Datastore::Error::FInvalidStatusError::TypeString == Task->GetTask().Error()->Type())
{
// DataObject is not in operable state.
}
if (Gs2::Datastore::Error::FNotUploadedError::TypeString == Task->GetTask().Error()->Type())
{
// DataObject is not uploaded.
}
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
listMyDataObjects
Get list of data objects
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
status | enum [‘ACTIVE’, ‘UPLOADING’, ‘DELETED’] | | | ~ 128 chars | Status |
pageToken | string | | | ~ 1024 chars | Token specifying the position from which to start acquiring data |
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
| Type | Description |
---|
items | List<EzDataObject> | List of Data object |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.DataObjectsAsync(
).ToListAsync();
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.DataObjects(
);
List<EzDataObject> items = new List<EzDataObject>();
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->DataObjects( // status
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeDataObjects(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeDataObjects(callbackId);
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.DataObjects(
);
List<EzDataObject> items = new List<EzDataObject>();
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeDataObjects(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeDataObjects(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
prepareDownload
Report completion of data upload
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
dataObjectId | string | ✓ | | ~ 1024 chars | Data object GRN |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
| Type | Description |
---|
item | EzDataObject | Data object |
fileUrl | string | URL to download the file |
contentLength | long | File size |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.PrepareDownloadAsync(
dataObjectId: "grn:dataObject-0001"
);
var item = await result.ModelAsync();
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.PrepareDownloadFuture(
dataObjectId: "grn:dataObject-0001"
);
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;
var fileUrl = future.Result.FileUrl;
var contentLength = future.Result.ContentLength;
const auto Domain = Gs2->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto Future = Domain->PrepareDownload(
"grn:dataObject-0001"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
const auto FileUrl = Result->FileUrl;
const auto ContentLength = Result->ContentLength;
prepareDownloadByUserIdAndDataObjectName
Prepare to download data by specifying user ID and data name
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
userId | string | ✓ | | ~ 128 chars | User Id |
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name |
Result
| Type | Description |
---|
item | EzDataObject | Data object |
fileUrl | string | URL to download the file |
contentLength | long | File size |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).DataObject(
dataObjectName: "dataObject-0001"
);
var result = await domain.PrepareDownloadByUserIdAndDataObjectNameAsync(
);
var item = await result.ModelAsync();
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).DataObject(
dataObjectName: "dataObject-0001"
);
var future = domain.PrepareDownloadByUserIdAndDataObjectNameFuture(
);
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;
var fileUrl = future.Result.FileUrl;
var contentLength = future.Result.ContentLength;
const auto Domain = Gs2->Datastore->Namespace(
"namespace-0001" // namespaceName
)->User(
"user-0001" // userId
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto Future = Domain->PrepareDownloadByUserIdAndDataObjectName(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
const auto FileUrl = Result->FileUrl;
const auto ContentLength = Result->ContentLength;
prepareDownloadOwnData
Prepare to download your own data
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
| Type | Description |
---|
item | EzDataObject | Data object |
fileUrl | string | URL to download the file |
contentLength | long | File size |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var result = await domain.PrepareDownloadOwnDataAsync(
);
var item = await result.ModelAsync();
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var future = domain.PrepareDownloadOwnDataFuture(
);
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;
var fileUrl = future.Result.FileUrl;
var contentLength = future.Result.ContentLength;
const auto Domain = Gs2->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto Future = Domain->PrepareDownloadOwnData(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
const auto FileUrl = Result->FileUrl;
const auto ContentLength = Result->ContentLength;
prepareReUpload
Prepare to re-upload data
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
dataObjectName | string | ✓ | UUID | ~ 128 chars | Data object Name |
contentType | string | ✓ | “application/octet-stream” | ~ 256 chars | MIME-Type of the data to be uploaded |
Result
| Type | Description |
---|
item | EzDataObject | Data object |
uploadUrl | string | URL used to execute the upload process |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var result = await domain.PrepareReUploadAsync(
contentType: null
);
var item = await result.ModelAsync();
var uploadUrl = result.UploadUrl;
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var future = domain.PrepareReUploadFuture(
contentType: null
);
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;
var uploadUrl = future.Result.UploadUrl;
const auto Domain = Gs2->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto Future = Domain->PrepareReUpload(
nullptr // contentType
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
const auto UploadUrl = Result->UploadUrl;
prepareUpload
Prepare to upload data
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
name | string | | | ~ 128 chars | Data object name |
scope | enum [‘public’, ‘protected’, ‘private’] | ✓ | “private” | ~ 128 chars | File access permission |
contentType | string | ✓ | “application/octet-stream” | ~ 256 chars | MIME-Type of the data to be uploaded |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published |
updateIfExists | bool | ✓ | false | | Whether to raise an error if data already exists or to update the data |
Result
| Type | Description |
---|
item | EzDataObject | Data object |
uploadUrl | string | URL used to execute the upload process |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.PrepareUploadAsync(
name: "dataObject-0001",
scope: "public",
contentType: null,
allowUserIds: null,
updateIfExists: null
);
var item = await result.ModelAsync();
var uploadUrl = result.UploadUrl;
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.PrepareUploadFuture(
name: "dataObject-0001",
scope: "public",
contentType: null,
allowUserIds: null,
updateIfExists: null
);
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;
var uploadUrl = future.Result.UploadUrl;
const auto Domain = Gs2->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto Future = Domain->PrepareUpload(
"dataObject-0001", // name
"public", // scope
nullptr, // contentType
nullptr, // allowUserIds
nullptr // updateIfExists
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
const auto UploadUrl = Result->UploadUrl;
restoreDataObject
Repair data management information
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
dataObjectId | string | ✓ | | ~ 1024 chars | Data object GRN |
Result
Error
Special exceptions are defined in this API.
GS2-SDK for GameEngine provides specialized exceptions derived from general exceptions to facilitate handling of errors that may need to be handled in games.
Please refer to the documentation here for more information on common error types and handling methods.
Type | Base Type | Description |
---|
InvalidStatusException | BadRequestException | DataObject is not in operable state. |
Implementation Example
try {
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
);
var result = await domain.RestoreDataObjectAsync(
dataObjectId: "grn:dataObject-0001"
);
var item = await result.ModelAsync();
} catch(Gs2.Gs2Datastore.Exception.InvalidStatus e) {
// DataObject is not in operable state.
}
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
);
var future = domain.RestoreDataObjectFuture(
dataObjectId: "grn:dataObject-0001"
);
yield return future;
if (future.Error != null)
{
if (future.Error is Gs2.Gs2Datastore.Exception.InvalidStatusException)
{
// DataObject is not in operable state.
}
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->Datastore->Namespace(
"namespace-0001" // namespaceName
);
const auto Future = Domain->RestoreDataObject(
"grn:dataObject-0001"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
if (Gs2::Datastore::Error::FInvalidStatusError::TypeString == Task->GetTask().Error()->Type())
{
// DataObject is not in operable state.
}
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
updateDataObject
Update data objects
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
scope | enum [‘public’, ‘protected’, ‘private’] | ✓ | “private” | ~ 128 chars | File access permission |
allowUserIds | List<string> | {scope} != none and {scope} == “protected” | [] | ~ 10000 items | List of user IDs to be published |
Result
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var result = await domain.UpdateDataObjectAsync(
scope: "public",
allowUserIds: null
);
var item = await result.ModelAsync();
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var future = domain.UpdateDataObjectFuture(
scope: "public",
allowUserIds: null
);
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto Future = Domain->UpdateDataObject(
"public", // scope
nullptr // allowUserIds
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
listDataObjectHistories
Obtain list of data object history
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
dataObjectName | string | ✓ | | ~ 128 chars | Data object name |
pageToken | string | | | ~ 1024 chars | Token specifying the position from which to start acquiring data |
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
| Type | Description |
---|
items | List<EzDataObjectHistory> | List of History of Data object |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var items = await domain.DataObjectHistoriesAsync(
).ToListAsync();
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var it = domain.DataObjectHistories(
);
List<EzDataObjectHistory> items = new List<EzDataObjectHistory>();
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
const auto It = Domain->DataObjectHistories(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
// Start event handling
var callbackId = domain.SubscribeDataObjectHistories(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeDataObjectHistories(callbackId);
var domain = gs2.Datastore.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).DataObject(
dataObjectName: "dataObject-0001"
);
var it = domain.DataObjectHistories(
);
List<EzDataObjectHistory> items = new List<EzDataObjectHistory>();
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->Datastore->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->DataObject(
"dataObject-0001" // dataObjectName
);
// Start event handling
const auto CallbackId = Domain->SubscribeDataObjectHistories(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeDataObjectHistories(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.