GS2-Friend Script Trigger Reference
Trigger
updateProfile
Profile updates
Synchronous Execution Script
The script is executed synchronously before the profile updates process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| profile | Profile | Profile |
| oldProfile | Profile | Old Profile |
| publicProfile | string | New Public profile |
| followerProfile | string | New Profile for followers |
| friendProfile | string | New Profile for friends |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow profile updates |
Implementation Example
-- Request
local namespace = args.namespace
local profile = args.profile
local oldProfile = args.oldProfile
local publicProfile = args.publicProfile
local followerProfile = args.followerProfile
local friendProfile = args.friendProfile
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the profile updates process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldProfile | Profile | Profile before update |
| profile | Profile | Profile after update |
Implementation Example
-- Request
local namespace = args.namespace
local oldProfile = args.oldProfile
local profile = args.profile
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}follow
Follow
Synchronous Execution Script
The script is executed synchronously before the follow process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| followUser | FollowUser | Follow Information |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow the follow operation |
Implementation Example
-- Request
local namespace = args.namespace
local followUser = args.followUser
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the follow process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| followUser | FollowUser | Follow Information |
Implementation Example
-- Request
local namespace = args.namespace
local followUser = args.followUser
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}unfollow
Unfollow
Synchronous Execution Script
The script is executed synchronously before the unfollow process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| followUser | FollowUser | Follow Information |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow the unfollow operation |
Implementation Example
-- Request
local namespace = args.namespace
local followUser = args.followUser
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the unfollow process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| followUser | FollowUser | Follow Information |
Implementation Example
-- Request
local namespace = args.namespace
local followUser = args.followUser
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}deleteFriend
Delete friend
Synchronous Execution Script
The script is executed synchronously before the delete friend process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| userId | string | User ID |
| friendUser | FriendUser | Friend |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow delete friend |
Implementation Example
-- Request
local namespace = args.namespace
local userId = args.userId
local friendUser = args.friendUser
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the delete friend process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| userId | string | User ID |
| friendUser | FriendUser | Friend |
Implementation Example
-- Request
local namespace = args.namespace
local userId = args.userId
local friendUser = args.friendUser
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}sendRequest
Friend requests to be issued
Synchronous Execution Script
The script is executed synchronously before the friend requests to be issued process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow friend requests to be issued |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the friend requests to be issued process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}cancelRequest
Cancellation of friend request
Synchronous Execution Script
The script is executed synchronously before the cancellation of friend request process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow cancellation of friend request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the cancellation of friend request process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}acceptRequest
Accepting the friend request
Synchronous Execution Script
The script is executed synchronously before the accepting the friend request process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow accepting the friend request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the accepting the friend request process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}rejectRequest
Rejecting the friend request
Synchronous Execution Script
The script is executed synchronously before the rejecting the friend request process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow rejecting the friend request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Business logic:
local permit = true
-- Result
result = {
permit=permit
}Asynchronous Execution Script
The script is executed asynchronously after the rejecting the friend request process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| friendRequest | FriendRequest | Friend Request |
Implementation Example
-- Request
local namespace = args.namespace
local friendRequest = args.friendRequest
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}