> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Version Script Trigger Reference

Reference for event triggers that call extended scripts



## Trigger

### acceptVersion

Version approval

**Related methods:**
accept - Approve current version
acceptByUserId - Approve current version by User ID
reject - Reject current version
rejectByUserId - Reject current version by User ID


#### Synchronous Execution Script

The script is executed synchronously before the version approval process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| versionModel | [VersionModel](../sdk/#versionmodel) | Version Model |
| acceptVersion | [AcceptVersion](../sdk/#acceptversion) | Agreed Version |
| currentAcceptVersion | [AcceptVersion](../sdk/#acceptversion) | Current Agreed Version |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow version approval |

##### Implementation Example


**Lua**
```lua

-- 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](../sdk/#namespace) | Namespace |
| versionModel | [VersionModel](../sdk/#versionmodel) | Version Model |
| acceptVersion | [AcceptVersion](../sdk/#acceptversion) | Agreed Version |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local versionModel = args.versionModel
local acceptVersion = args.acceptVersion

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  
### checkVersion

Version check

**Related methods:**
checkVersion - Check Version


#### Synchronous Execution Script

The script is executed synchronously before the version check process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| versionModel | [VersionModel](../sdk/#versionmodel) | Version Model |
| currentVersion | [Version](../sdk/#version) | Current Version |
| userId | string | User ID |
| warning | [Status](../sdk/#status) | If the normal version check results in a warning |
| error | [Status](../sdk/#status) | If the normal version check results in an error |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| overrideWarning | [Status](../sdk/#status) |  |  |  | Warning for overwritten version check results |
| overrideError | [Status](../sdk/#status) |  |  |  | Error for overwritten version check results |

##### Implementation Example


**Lua**
```lua

-- 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
}
```


---
  



