API Reference of GS2-Version SDK for Game Engine
Model
EzVersion
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
major | int | ✓ | ~ 2147483646 | Major version | |
minor | int | ✓ | ~ 2147483646 | Minor version | |
micro | int | ✓ | ~ 2147483646 | Micro version |
EzVersionModel
Version Model
You can set a warning version that accepts login but notifies you that you can upgrade, and an error version that does not accept login.
You can specify whether or not to have the client declare the current version with or without a signature. If you select signed, the client will not be able to declare a false version.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Version Model Name | |
metadata | string | ~ 2048 chars | metadata | ||
warningVersion | EzVersion | {type} == “simple” | Version that prompts for version upgrade | ||
errorVersion | EzVersion | {type} == “simple” | Version that kicks version check | ||
scope | enum [‘passive’, ‘active’] | ✓ | ~ 128 chars | Type of version value used for judgment | |
currentVersion | EzVersion | {type} == “simple” and {scope} == “active” | Current Version | ||
needSignature | bool | {scope} == “passive” | Whether the version value to be determined requires signature verification |
EzAcceptVersion
Approved Version
Not a version tied to data, such as an app version or asset version. Used for entities that require version control on a per-user basis, such as a version of an agreed upon Terms of Use.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
versionName | string | ✓ | ~ 128 chars | Approved Version Name | |
userId | string | ✓ | ~ 128 chars | User Id | |
version | EzVersion | ✓ | Approved Version |
EzStatus
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
versionModel | EzVersionModel | ✓ | Version Model | ||
currentVersion | EzVersion | Current Version |
EzTargetVersion
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
versionName | string | ✓ | ~ 128 chars | Version Name | |
version | EzVersion | {signature} == "" | Version | ||
body | string | ~ 1048576 chars | Body | ||
signature | string | ~ 256 chars | Signature |
Methods
getVersionModel
Get version settings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
versionName | string | ✓ | ~ 128 chars | Version Model Name |
Result
Type | Description | |
---|---|---|
item | EzVersionModel | Version Setting |
Implementation Example
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;
}
Value change event handling
var domain = gs2.Version.Namespace(
namespaceName: "namespace-0001"
).VersionModel(
versionName: "version-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.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
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Version::Model::FVersionModel> 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.
listVersionModels
Get list of version settings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
items | List<EzVersionModel> | List of Version Settings |
Implementation Example
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(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Version.Namespace(
namespaceName: "namespace-0001"
);
// Start event handling
var callbackId = domain.SubscribeVersionModels(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
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
);
// Start event handling
const auto CallbackId = Domain->SubscribeVersionModels(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeVersionModels(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.
accept
Approve Version
Used for terms of use, etc.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
versionName | string | ✓ | ~ 128 chars | Approved Version Name |
Result
Type | Description | |
---|---|---|
item | EzAcceptVersion | Approved Version |
Implementation Example
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(
AccessToken
)->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 (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
delete
Delete the approved version
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
versionName | string | ✓ | ~ 128 chars | Approved Version Name |
Result
Type | Description | |
---|---|---|
item | EzAcceptVersion | Deleted approved version |
Implementation Example
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(
AccessToken
)->AcceptVersion(
"eula" // versionName
);
const auto Future = Domain->Delete(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
list
Get list of approved versions
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
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<EzAcceptVersion> | List of Approved Versions |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
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(
AccessToken
);
const auto It = Domain->AcceptVersions(
);
for (auto Item : *It)
{
}
Value change event handling
var domain = gs2.Version.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeAcceptVersions(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
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(
AccessToken
);
// Start event handling
const auto CallbackId = Domain->SubscribeAcceptVersions(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeAcceptVersions(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.
checkVersion
Perform version check
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetVersions | List<EzTargetVersion> | [] | ~ 1000 items | List of Versions to be verified |
Result
Type | Description | |
---|---|---|
projectToken | string | Project Token |
warnings | List<EzStatus> | Version Verification Results List of Warnings |
errors | List<EzStatus> | Version Verification Results List of errors |
Implementation Example
var domain = gs2.Version.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Checker(
);
var result = await domain.CheckVersionAsync(
targetVersions: new Gs2.Unity.Gs2Version.Model.EzTargetVersion[] {
new Gs2.Unity.Gs2Version.Model.EzTargetVersion
{
VersionName = "app",
Version =
{
Major = 1,
Minor = 2,
Micro = 3,
},
},
new Gs2.Unity.Gs2Version.Model.EzTargetVersion
{
VersionName = "asset",
Version =
{
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 Gs2.Unity.Gs2Version.Model.EzTargetVersion[] {
new Gs2.Unity.Gs2Version.Model.EzTargetVersion
{
VersionName = "app",
Version =
{
Major = 1,
Minor = 2,
Micro = 3,
},
},
new Gs2.Unity.Gs2Version.Model.EzTargetVersion
{
VersionName = "asset",
Version =
{
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(
AccessToken
)->Checker(
);
const auto Future = Domain->CheckVersion(
[]
{
const auto v = MakeShared<TArray<TSharedPtr<Gs2::Version::Model::FTargetVersion>>>();
v->Add({'versionName': 'app', 'version': {'major': 1, 'minor': 2, 'micro': 3}});
v->Add({'versionName': 'asset', 'version': {'major': 1, 'minor': 2, 'micro': 3}});
return v;
}() // targetVersions
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto ProjectToken = Result->ProjectToken;
const auto Warnings = Result->Warnings;
const auto Errors = Result->Errors;