API Reference of GS2-Dictionary SDK for Game Engine
Model
EzEntryModel
The entry model is the entity to be recorded in the index. This section defines what kind of entities can be recorded in the index.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Entry Name | |
metadata | string | ~ 2048 chars | metadata |
EzEntry
Entries obtained by game players
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
entryId | string | ✓ | ~ 1024 chars | Entry GRN | |
userId | string | ✓ | ~ 128 chars | User Id | |
name | string | ✓ | ~ 128 chars | Entry Name | |
acquiredAt | long | ✓ | Now | Date of acquisition |
EzConfig
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
key | string | ✓ | ~ 64 chars | Name | |
value | string | ~ 51200 chars | Value |
Methods
getEntryModel
Get entry model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
entryName | string | ✓ | ~ 128 chars | Entry Name |
Result
Type | Description | |
---|---|---|
item | EzEntryModel | Entry model |
Implementation Example
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).EntryModel(
entryName: "entry-0001"
);
var item = await domain.ModelAsync();
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).EntryModel(
entryName: "entry-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->EntryModel(
"entry-0001" // entryName
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).EntryModel(
entryName: "entry-0001"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).EntryModel(
entryName: "entry-0001"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->EntryModel(
"entry-0001" // entryName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Dictionary::Model::FEntryModel> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(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.
listEntryModels
Get list of entry model information
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzEntryModel> | List of Entry models |
Implementation Example
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
);
var items = await domain.EntryModelsAsync(
).ToListAsync();
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.EntryModels(
);
List<EzEntryModel> items = new List<EzEntryModel>();
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->Dictionary->Namespace(
"namespace-0001" // namespaceName
);
const auto It = Domain->EntryModels(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeEntryModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeEntryModels(callbackId);
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
);
var it = domain.EntryModels(
);
List<EzEntryModel> items = new List<EzEntryModel>();
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->Dictionary->Namespace(
"namespace-0001" // namespaceName
);
// Start event handling
const auto CallbackId = Domain->SubscribeEntryModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeEntryModels(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.
getEntry
Get an entry
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
entryModelName | string | ✓ | ~ 128 chars | Entry Name |
Result
Type | Description | |
---|---|---|
item | EzEntry | Entry |
Implementation Example
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Entry(
entryName: null
);
var item = await domain.ModelAsync();
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Entry(
entryName: null
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Entry(
nullptr // entryName
);
const auto Future = Domain.Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Entry(
entryName: null
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Entry(
entryName: null
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Entry(
nullptr // entryName
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Dictionary::Model::FEntry> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(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.
getEntryWithSignature
Get entry with signature
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
entryModelName | string | ✓ | ~ 128 chars | Entry Name | |
keyId | string | ✓ | ~ 1024 chars | encryption key GRN |
Result
Type | Description | |
---|---|---|
item | EzEntry | Entry |
body | string | Entry information for signature subject |
signature | string | signature |
Implementation Example
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Entry(
entryName: null
);
var result = await domain.GetEntryWithSignatureAsync(
entryModelName: "entry-0001",
keyId: "key-0001"
);
var item = await result.ModelAsync();
var body = result.Body;
var signature = result.Signature;
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Entry(
entryName: null
);
var future = domain.GetEntryWithSignatureFuture(
entryModelName: "entry-0001",
keyId: "key-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 body = future.Result.Body;
var signature = future.Result.Signature;
const auto Domain = Gs2->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Entry(
nullptr // entryName
);
const auto Future = Domain->GetEntryWithSignature(
"entry-0001",
"key-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 Body = Result->Body;
const auto Signature = Result->Signature;
listEntries
Get list of entries
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
limit | int | ✓ | 30 | 1 ~ 10000 | Number of data acquired |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data |
Result
Type | Description | |
---|---|---|
items | List<EzEntry> | List of Entries |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.EntriesAsync(
).ToListAsync();
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Entries(
);
List<EzEntry> items = new List<EzEntry>();
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->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
const auto It = Domain->Entries(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeEntries(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeEntries(callbackId);
var domain = gs2.Dictionary.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Entries(
);
List<EzEntry> items = new List<EzEntry>();
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->Dictionary->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeEntries(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeEntries(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.