GS2-Friend Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

updateProfile

Update profile

Synchronous Execution Script

The script is executed synchronously before the update profile process.

Request
TypeDescription
namespaceNamespaceNamespace
profileProfileProfile
oldProfileProfileOld profile
publicProfilestringNew Public profile
followerProfilestringNew profile for followers
friendProfilestringNew profile for friends
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow update profile
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 update profile process.

Request
TypeDescription
namespaceNamespaceNamespace
oldProfileProfileProfile before update
profileProfileProfile 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
TypeDescription
namespaceNamespaceNamespace
followUserFollowUserFollow Information
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
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
TypeDescription
namespaceNamespaceNamespace
followUserFollowUserFollow 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
TypeDescription
namespaceNamespaceNamespace
followUserFollowUserFollow Information
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
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
TypeDescription
namespaceNamespaceNamespace
followUserFollowUserFollow 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
TypeDescription
namespaceNamespaceNamespace
userIdstringUser ID
friendUserFriendUserFriend
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow deleting a 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
TypeDescription
namespaceNamespaceNamespace
userIdstringUser ID
friendUserFriendUserFriend
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

Send Friend Request

Synchronous Execution Script

The script is executed synchronously before the send friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend Request
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow send 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 send friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend 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

Cancel Friend Request

Synchronous Execution Script

The script is executed synchronously before the cancel friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend Request
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
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 cancel friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend 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

Accept Friend Request

Synchronous Execution Script

The script is executed synchronously before the accept friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend Request
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
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 accept friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend 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

Reject Friend Request

Synchronous Execution Script

The script is executed synchronously before the reject friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend Request
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
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 reject friend request process.

Request
TypeDescription
namespaceNamespaceNamespace
friendRequestFriendRequestFriend 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 = {
}