GS2-Version Script Trigger Reference

Reference for event triggers that call extended scripts

Trigger

acceptVersion

Version approval

Synchronous Execution Script

The script is executed synchronously before the version approval process.

Request
Type Description
namespace Namespace Namespace
versionModel VersionModel Version Model
acceptVersion AcceptVersion Agreed Version
currentAcceptVersion AcceptVersion Current Agreed Version
Result
Type Required Default Value Limits Description
permit bool
Whether to allow version approval
Implementation Example
-- Request
local namespace = args.namespace
local versionModel = args.versionModel
local acceptVersion = args.acceptVersion
local currentAcceptVersion = args.currentAcceptVersion

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the version approval process.

Request
Type Description
namespace Namespace Namespace
versionModel VersionModel Version Model
acceptVersion AcceptVersion Agreed Version
Implementation Example
-- Request
local namespace = args.namespace
local versionModel = args.versionModel
local acceptVersion = args.acceptVersion

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

checkVersion

Version check

Synchronous Execution Script

The script is executed synchronously before the version check process.

Request
Type Description
namespace Namespace Namespace
versionModel VersionModel Version Model
currentVersion Version Current Version
userId string User ID
warning Status If the normal version check results in a warning
error Status If the normal version check results in an error
Result
Type Required Default Value Limits Description
overrideWarning Status Warning for overwritten version check results
overrideError Status Error for overwritten version check results
Implementation Example
-- Request
local namespace = args.namespace
local versionModel = args.versionModel
local currentVersion = args.currentVersion
local userId = args.userId
local warning = args.warning
local error = args.error

-- Business logic:
local overrideWarning = nil
local overrideError = nil

-- Result
result = {
  overrideWarning=overrideWarning,
  overrideError=overrideError
}