GS2-Friend SDK API Reference
Model
Namespace
Namespace
A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.
Therefore, you must create a namespace before you can start using each service.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceId | string | * | ~ 1024 chars | Namespace GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | Transaction Setting Configuration for controlling how transactions are processed when executing friend operations. | ||||
| followScript | ScriptSetting | Script to run when followed Script Trigger Reference - follow | ||||
| unfollowScript | ScriptSetting | Script to run when unfollowed Script Trigger Reference - unfollow | ||||
| sendRequestScript | ScriptSetting | Script to run when a friend request is issued Script Trigger Reference - sendRequest | ||||
| cancelRequestScript | ScriptSetting | Script to execute when a friend request is canceled Script Trigger Reference - cancelRequest | ||||
| acceptRequestScript | ScriptSetting | Script to run when a friend request is accepted Script Trigger Reference - acceptRequest | ||||
| rejectRequestScript | ScriptSetting | Script to execute when a friend request is rejected Script Trigger Reference - rejectRequest | ||||
| deleteFriendScript | ScriptSetting | Script to run when a friend is deleted Script Trigger Reference - deleteFriend | ||||
| updateProfileScript | ScriptSetting | Script to run when a profile is updated Script Trigger Reference - updateProfile | ||||
| followNotification | NotificationSetting | Push notification when followed Configuration for sending a push notification to a player when another player starts following them. Allows the followed player to be notified in real time via GS2-Gateway. | ||||
| receiveRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is received Configuration for sending a push notification to a player when they receive a friend request from another player. Enables the recipient to respond promptly via GS2-Gateway. | |||
| cancelRequestNotification | NotificationSetting | ✓ | Push notification when a received friend request is canceled Configuration for sending a push notification to a player when a friend request they previously received is canceled by the sender. Notifies the recipient that the pending request no longer exists. | |||
| acceptRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is approved Configuration for sending a push notification to a player when their sent friend request is accepted by the recipient. Both players are then added to each other’s friend lists. | |||
| rejectRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is rejected Configuration for sending a push notification to a player when their sent friend request is rejected by the recipient. The friend request is removed from both the send box and inbox. | |||
| deleteFriendNotification | NotificationSetting | ✓ | Push notification when a friend is deleted Configuration for sending a push notification to a player when they are removed from another player’s friend list. The friendship is terminated for both sides. | |||
| logSetting | LogSetting | Log Output Setting Configuration for outputting log data of friend operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for follow/unfollow, friend requests, and profile updates can be collected. | ||||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
TransactionSetting
Transaction Setting
Transaction Setting controls how transactions are executed, including their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | Whether to automatically execute issued transactions on the server side | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | Whether to commit the execution of transactions atomically * Applicable only if enableAutoRun is true | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | Whether to execute transactions asynchronously * Applicable only if enableAtomicCommit is true | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | Whether to execute the commit processing of the script result asynchronously * Applicable only if transactionUseDistributor is true | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | Whether to use GS2-JobQueue to execute the acquire action * Applicable only if enableAtomicCommit is true | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor Namespace GRN used to execute transactions | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | GS2-JobQueue Namespace GRN used to execute transactions |
ScriptSetting
Script Setting
In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.
There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script’s execution results to halt API execution or control the API’s response content.
In contrast, asynchronous execution does not block processing until the script has finished executing. However, because the script result cannot be used to stop the API execution or modify the API response, asynchronous execution does not affect the API response flow and is generally recommended.
There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024 chars | GS2-Script script GRN
executed synchronously when the API is executed Must be specified in GRN format starting with “grn:gs2:”. | |||||||||||
| doneTriggerTargetType | String Enum enum { “none”, “gs2_script”, “aws” } | “none” | How to execute asynchronous scripts Specifies the type of script to use for asynchronous execution. You can choose from “Do not use asynchronous execution (none)”, “Use GS2-Script (gs2_script)”, and “Use Amazon EventBridge (aws)”.
| |||||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-Script script GRN
for asynchronous execution Must be specified in GRN format starting with “grn:gs2:”. * Applicable only if doneTriggerTargetType is “gs2_script” | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-JobQueue namespace GRN
to execute asynchronous execution scripts If you want to execute asynchronous execution scripts via GS2-JobQueue instead of executing them directly, specify the GS2-JobQueue namespace GRN. There are not many cases where GS2-JobQueue is required, so you generally do not need to specify it unless you have a specific reason. * Applicable only if doneTriggerTargetType is “gs2_script” |
NotificationSetting
Push Notification Settings
This is a setting for sending push notifications when an event occurs in a GS2 microservice. The push notification here refers to the processing via the WebSocket interface provided by GS2-Gateway, and is different from the push notification of a smartphone. For example, when a matchmaking is completed or a friend request is received, the GS2-Gateway can send a push notification via the WebSocket interface, and the game client can detect the change of the state.
GS2-Gateway’s push notifications can be used to forward notifications to mobile push notification services when the destination device is offline. By properly utilizing mobile push notifications, you can implement a flow in which players are notified even if they exit the game during matchmaking and later return to it.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gatewayNamespaceId | string | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024 chars | GS2-Gateway namespace to use for push notifications Specify the GS2-Gateway namespace ID in GRN format starting with “grn:gs2:”. | ||||||||
| enableTransferMobileNotification | bool? | false | Whether to forward the notification as a mobile push notification When this notification is sent and the destination device is offline, specify whether to forward it as a mobile push notification. | |||||||||
| sound | string | {enableTransferMobileNotification} == true | ~ 1024 chars | Sound file name to be used for mobile push notifications The sound file name specified here is used when sending mobile push notifications, and you can send notifications with a special sound. * Applicable only if enableTransferMobileNotification is true | ||||||||
| enable | String Enum enum { “Enabled”, “Disabled” } | “Enabled” | Whether to enable push notifications
|
LogSetting
Log Output Setting
Log Output Setting defines how log data is exported. This type holds the GS2-Log namespace identifier (Namespace ID) used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, debugging, and other operational purposes.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024 chars | GS2-Log namespace GRN
to output logs Must be specified in GRN format starting with “grn:gs2:”. |
Profile
Profile
The profile stores information about the game player.
There are three types of profiles that can be set for each public range.
- friend The information that can be viewed by those with whom a friend relationship has been established.
- follow Content that can be viewed by followers.
- public Content that can be viewed by anyone
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| profileId | string | * | ~ 1024 chars | Profile GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| publicProfile | string | ~ 1024 chars | Public profile Profile information visible to all players regardless of relationship. Typically used for display names, avatars, or other publicly shareable information. | |||
| followerProfile | string | ~ 1024 chars | Profile for followers Profile information visible only to players who follow this user. Can contain more detailed information than the public profile, such as gameplay statistics or status messages. | |||
| friendProfile | string | ~ 1024 chars | Profile for friends Profile information visible only to players who have an established mutual friend relationship. The most private profile level, suitable for sharing personal information like contact details or private messages. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
Follow
Follow
A follow is a unidirectional relationship between game players. The relationship is established immediately upon sending a follow request.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| followId | string | * | ~ 1024 chars | Follow GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserIds | List<string> | 0 ~ 1000 items | List of user IDs that the user follows The list of user IDs that this user is following. Unlike friend relationships, follows are unidirectional and established immediately without requiring approval from the target user. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
Friend
Friend
A friend is a two-way, approved relationship between game players. To establish a friend relationship, one party must send a request and the other party must approve it.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| friendId | string | * | ~ 1024 chars | Friend GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserIds | List<string> | 0 ~ 1000 items | User ID list of friends The list of user IDs with whom this user has an established mutual friend relationship. Both users must have gone through the friend request approval process. Removing a friend removes the entry from both users’ lists. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
SendBox
Send Box
Manages the list of outgoing friend requests sent by a player. When a player sends a friend request, the target user ID is added to this send box. The sender can cancel a pending request. Duplicate requests to the same user or requests to existing friends are rejected. When the target accepts or rejects, the entry is removed from this send box.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| sendBoxId | string | * | ~ 1024 chars | Friend Request Send Box GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserIds | List<string> | 0 ~ 1000 items | Destination user ID list for friend requests The user IDs of players to whom this user has sent pending friend requests. Each entry represents an outgoing request awaiting the target’s response. Duplicate entries and requests to existing friends are prevented. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
Inbox
Inbox
Manages the list of received friend requests for a player. When another player sends a friend request, their user ID is added to this inbox. The player can then accept or reject each request. Duplicate requests from the same user or requests from existing friends are rejected. Accepting a request removes it from the inbox and adds both users to each other’s friend lists.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| inboxId | string | * | ~ 1024 chars | Friend Request Inbox GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| fromUserIds | List<string> | 0 ~ 1000 items | List of user IDs who have sent friend requests The user IDs of players who have sent pending friend requests to this user. Each entry represents an unanswered request that can be accepted or rejected. Duplicate entries and requests from existing friends are prevented. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
BlackList
Blacklist
Manages a list of users that the player has blocked. Blocked users are prevented from sending friend requests or follow requests to this player, providing a mechanism for players to control unwanted interactions.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| blackListId | string | * | ~ 1024 chars | Blacklist GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserIds | List<string> | 0 ~ 1000 items | Blacklist user ID list The list of user IDs that this player has blocked. Blocked users cannot send friend requests or follow requests to this player. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
FollowUser
Follow User
Represents a user that the current user is following. Provides access to the followed user’s public profile and follower-level profile information, which is visible to followers but not to the general public.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| publicProfile | string | ~ 1024 chars | Public profile The followed user’s publicly visible profile information, accessible to all players. | |||
| followerProfile | string | ~ 1024 chars | Profile for followers The followed user’s profile information visible only to their followers. Contains more detailed information than the public profile. |
FriendUser
Friend User
Represents a user who has an established mutual friend relationship with the current user. Provides access to the friend’s public profile and friend-level profile information, which is only visible to confirmed friends.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| publicProfile | string | ~ 1024 chars | Public profile The friend’s publicly visible profile information, accessible to all players. | |||
| friendProfile | string | ~ 1024 chars | Profile for friends The friend’s profile information visible only to confirmed friends. Contains more private information than the public profile. |
FriendRequest
Friend Request
Represents a friend request between two players. Contains the sender’s user ID, the recipient’s user ID, and the sender’s public profile for display purposes.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID of the sender of the friend request | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID to whom a friend request was sent | ||
| publicProfile | string | ~ 1024 chars | Public profile The public profile of the friend request sender. Included for display purposes so that the recipient can identify who is requesting friendship. |
SendFriendRequest
Sent Friend Request
This entity indicates the status of a pending Friend Request. This is a Friend Request sent by the user to another user. When the user who sent the Friend Request approves it, the Friend Request is deleted and the user is added to the friend list.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID of the sender of the Friend Request | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID to whom a Friend Request was sent | ||
| publicProfile | string | ~ 1024 chars | Public profile The public profile of the target user who received this friend request. Allows the sender to view basic information about the recipient. |
ReceiveFriendRequest
Received Friend Request
This entity indicates that a friend request has been accepted. This is a Friend Request received by the user from another user. When the user approves the friend request, the friend request is deleted and the user is added to the friend list.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID of the sender of the friend request | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID to whom a friend request was sent | ||
| publicProfile | string | ~ 1024 chars | Public profile The public profile of the user who sent this friend request. Allows the recipient to see who is requesting to be friends before accepting or rejecting. |
PublicProfile
Public Profile
A read-only view of a user’s publicly visible profile information. Can be retrieved for any user without requiring a friend or follow relationship. Used for displaying player information in search results, leaderboards, or other public contexts.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| publicProfile | string | ~ 1024 chars | Public profile The user’s publicly visible profile content, accessible without requiring a friend or follow relationship. |
Methods
describeNamespaces
Get a list of Namespaces
Retrieves a list of namespaces that have been created on a per-service basis within the project. You can use the optional page token to start acquiring data from a specific location in the list. You can also limit the number of namespaces to be acquired.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64 chars | Filter by Namespace name prefix | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<Namespace> | List of Namespace |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&friend.DescribeNamespacesRequest {
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->withNamePrefix(null)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeNamespacesRequest;
import io.gs2.friend.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeNamespacesResult result = client.describeNamespaces(
new DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Friend.Request.DescribeNamespacesRequest()
.WithNamePrefix(null)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Friend.DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_namespaces(
friend.DescribeNamespacesRequest()
.with_name_prefix(None)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_namespaces({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_namespaces_async({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createNamespace
Create a new Namespace
You must specify detailed information including the name, description, and various settings of the namespace.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | Transaction Setting Configuration for controlling how transactions are processed when executing friend operations. | ||||
| followScript | ScriptSetting | Script to run when followed Script Trigger Reference - follow | ||||
| unfollowScript | ScriptSetting | Script to run when unfollowed Script Trigger Reference - unfollow | ||||
| sendRequestScript | ScriptSetting | Script to run when a friend request is issued Script Trigger Reference - sendRequest | ||||
| cancelRequestScript | ScriptSetting | Script to execute when a friend request is canceled Script Trigger Reference - cancelRequest | ||||
| acceptRequestScript | ScriptSetting | Script to run when a friend request is accepted Script Trigger Reference - acceptRequest | ||||
| rejectRequestScript | ScriptSetting | Script to execute when a friend request is rejected Script Trigger Reference - rejectRequest | ||||
| deleteFriendScript | ScriptSetting | Script to run when a friend is deleted Script Trigger Reference - deleteFriend | ||||
| updateProfileScript | ScriptSetting | Script to run when a profile is updated Script Trigger Reference - updateProfile | ||||
| followNotification | NotificationSetting | Push notification when followed Configuration for sending a push notification to a player when another player starts following them. Allows the followed player to be notified in real time via GS2-Gateway. | ||||
| receiveRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is received Configuration for sending a push notification to a player when they receive a friend request from another player. Enables the recipient to respond promptly via GS2-Gateway. | |||
| cancelRequestNotification | NotificationSetting | ✓ | Push notification when a received friend request is canceled Configuration for sending a push notification to a player when a friend request they previously received is canceled by the sender. Notifies the recipient that the pending request no longer exists. | |||
| acceptRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is approved Configuration for sending a push notification to a player when their sent friend request is accepted by the recipient. Both players are then added to each other’s friend lists. | |||
| rejectRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is rejected Configuration for sending a push notification to a player when their sent friend request is rejected by the recipient. The friend request is removed from both the send box and inbox. | |||
| deleteFriendNotification | NotificationSetting | ✓ | Push notification when a friend is deleted Configuration for sending a push notification to a player when they are removed from another player’s friend list. The friendship is terminated for both sides. | |||
| logSetting | LogSetting | Log Output Setting Configuration for outputting log data of friend operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for follow/unfollow, friend requests, and profile updates can be collected. |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&friend.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
TransactionSetting: nil,
FollowScript: nil,
UnfollowScript: nil,
SendRequestScript: nil,
CancelRequestScript: nil,
AcceptRequestScript: nil,
RejectRequestScript: nil,
DeleteFriendScript: nil,
UpdateProfileScript: nil,
FollowNotification: nil,
ReceiveRequestNotification: nil,
CancelRequestNotification: nil,
AcceptRequestNotification: nil,
RejectRequestNotification: nil,
DeleteFriendNotification: nil,
LogSetting: &friend.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName("namespace-0001")
->withDescription(null)
->withTransactionSetting(null)
->withFollowScript(null)
->withUnfollowScript(null)
->withSendRequestScript(null)
->withCancelRequestScript(null)
->withAcceptRequestScript(null)
->withRejectRequestScript(null)
->withDeleteFriendScript(null)
->withUpdateProfileScript(null)
->withFollowNotification(null)
->withReceiveRequestNotification(null)
->withCancelRequestNotification(null)
->withAcceptRequestNotification(null)
->withRejectRequestNotification(null)
->withDeleteFriendNotification(null)
->withLogSetting((new \Gs2\Friend\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CreateNamespaceRequest;
import io.gs2.friend.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new io.gs2.friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Friend.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithTransactionSetting(null)
.WithFollowScript(null)
.WithUnfollowScript(null)
.WithSendRequestScript(null)
.WithCancelRequestScript(null)
.WithAcceptRequestScript(null)
.WithRejectRequestScript(null)
.WithDeleteFriendScript(null)
.WithUpdateProfileScript(null)
.WithFollowNotification(null)
.WithReceiveRequestNotification(null)
.WithCancelRequestNotification(null)
.WithAcceptRequestNotification(null)
.WithRejectRequestNotification(null)
.WithDeleteFriendNotification(null)
.WithLogSetting(new Gs2.Gs2Friend.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Friend.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new Gs2Friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.create_namespace(
friend.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_transaction_setting(None)
.with_follow_script(None)
.with_unfollow_script(None)
.with_send_request_script(None)
.with_cancel_request_script(None)
.with_accept_request_script(None)
.with_reject_request_script(None)
.with_delete_friend_script(None)
.with_update_profile_script(None)
.with_follow_notification(None)
.with_receive_request_notification(None)
.with_cancel_request_notification(None)
.with_accept_request_notification(None)
.with_reject_request_notification(None)
.with_delete_friend_notification(None)
.with_log_setting(
friend.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
transactionSetting=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
transactionSetting=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getNamespaceStatus
Get Namespace status
Get the current status of the specified namespace. This includes whether the Namespace is active, pending, or in some other state.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&friend.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Statususe Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName("namespace-0001")
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetNamespaceStatusRequest;
import io.gs2.friend.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Friend.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Friend.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_namespace_status(
friend.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_namespace_status({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;client = gs2('friend')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;getNamespace
Get namespace
Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&friend.GetNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetNamespaceRequest;
import io.gs2.friend.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Friend.Request.GetNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Friend.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_namespace(
friend.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateNamespace
Update Namespace
Update the settings of the specified namespace. You can change the description of the Namespace and specific settings.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | Transaction Setting Configuration for controlling how transactions are processed when executing friend operations. | ||||
| followScript | ScriptSetting | Script to run when followed Script Trigger Reference - follow | ||||
| unfollowScript | ScriptSetting | Script to run when unfollowed Script Trigger Reference - unfollow | ||||
| sendRequestScript | ScriptSetting | Script to run when a friend request is issued Script Trigger Reference - sendRequest | ||||
| cancelRequestScript | ScriptSetting | Script to execute when a friend request is canceled Script Trigger Reference - cancelRequest | ||||
| acceptRequestScript | ScriptSetting | Script to run when a friend request is accepted Script Trigger Reference - acceptRequest | ||||
| rejectRequestScript | ScriptSetting | Script to execute when a friend request is rejected Script Trigger Reference - rejectRequest | ||||
| deleteFriendScript | ScriptSetting | Script to run when a friend is deleted Script Trigger Reference - deleteFriend | ||||
| updateProfileScript | ScriptSetting | Script to run when a profile is updated Script Trigger Reference - updateProfile | ||||
| followNotification | NotificationSetting | Push notification when followed Configuration for sending a push notification to a player when another player starts following them. Allows the followed player to be notified in real time via GS2-Gateway. | ||||
| receiveRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is received Configuration for sending a push notification to a player when they receive a friend request from another player. Enables the recipient to respond promptly via GS2-Gateway. | |||
| cancelRequestNotification | NotificationSetting | ✓ | Push notification when a received friend request is canceled Configuration for sending a push notification to a player when a friend request they previously received is canceled by the sender. Notifies the recipient that the pending request no longer exists. | |||
| acceptRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is approved Configuration for sending a push notification to a player when their sent friend request is accepted by the recipient. Both players are then added to each other’s friend lists. | |||
| rejectRequestNotification | NotificationSetting | ✓ | Push notification when a friend request is rejected Configuration for sending a push notification to a player when their sent friend request is rejected by the recipient. The friend request is removed from both the send box and inbox. | |||
| deleteFriendNotification | NotificationSetting | ✓ | Push notification when a friend is deleted Configuration for sending a push notification to a player when they are removed from another player’s friend list. The friendship is terminated for both sides. | |||
| logSetting | LogSetting | Log Output Setting Configuration for outputting log data of friend operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for follow/unfollow, friend requests, and profile updates can be collected. |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&friend.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
TransactionSetting: nil,
FollowScript: nil,
UnfollowScript: nil,
SendRequestScript: nil,
CancelRequestScript: nil,
AcceptRequestScript: nil,
RejectRequestScript: nil,
DeleteFriendScript: nil,
UpdateProfileScript: nil,
FollowNotification: nil,
ReceiveRequestNotification: nil,
CancelRequestNotification: nil,
AcceptRequestNotification: nil,
RejectRequestNotification: nil,
DeleteFriendNotification: nil,
LogSetting: &friend.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName("namespace-0001")
->withDescription("description1")
->withTransactionSetting(null)
->withFollowScript(null)
->withUnfollowScript(null)
->withSendRequestScript(null)
->withCancelRequestScript(null)
->withAcceptRequestScript(null)
->withRejectRequestScript(null)
->withDeleteFriendScript(null)
->withUpdateProfileScript(null)
->withFollowNotification(null)
->withReceiveRequestNotification(null)
->withCancelRequestNotification(null)
->withAcceptRequestNotification(null)
->withRejectRequestNotification(null)
->withDeleteFriendNotification(null)
->withLogSetting((new \Gs2\Friend\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UpdateNamespaceRequest;
import io.gs2.friend.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new io.gs2.friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Friend.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithTransactionSetting(null)
.WithFollowScript(null)
.WithUnfollowScript(null)
.WithSendRequestScript(null)
.WithCancelRequestScript(null)
.WithAcceptRequestScript(null)
.WithRejectRequestScript(null)
.WithDeleteFriendScript(null)
.WithUpdateProfileScript(null)
.WithFollowNotification(null)
.WithReceiveRequestNotification(null)
.WithCancelRequestNotification(null)
.WithAcceptRequestNotification(null)
.WithRejectRequestNotification(null)
.WithDeleteFriendNotification(null)
.WithLogSetting(new Gs2.Gs2Friend.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Friend.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withCancelRequestNotification(null)
.withAcceptRequestNotification(null)
.withRejectRequestNotification(null)
.withDeleteFriendNotification(null)
.withLogSetting(new Gs2Friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.update_namespace(
friend.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_transaction_setting(None)
.with_follow_script(None)
.with_unfollow_script(None)
.with_send_request_script(None)
.with_cancel_request_script(None)
.with_accept_request_script(None)
.with_reject_request_script(None)
.with_delete_friend_script(None)
.with_update_profile_script(None)
.with_follow_notification(None)
.with_receive_request_notification(None)
.with_cancel_request_notification(None)
.with_accept_request_notification(None)
.with_reject_request_notification(None)
.with_delete_friend_notification(None)
.with_log_setting(
friend.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
cancelRequestNotification=nil,
acceptRequestNotification=nil,
rejectRequestNotification=nil,
deleteFriendNotification=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteNamespace
Delete Namespace
Delete the specified namespace. This operation is irreversible and all data associated with the deleted Namespace will be lost.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | The deleted Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&friend.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteNamespaceRequest;
import io.gs2.friend.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Friend.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Friend.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.delete_namespace(
friend.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.delete_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getServiceVersion
Get the microservice version
Details
Request
Request parameters: None
Result
| Type | Description | |
|---|---|---|
| item | string | Version |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&friend.GetServiceVersionRequest {
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getServiceVersion(
(new GetServiceVersionRequest())
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetServiceVersionRequest;
import io.gs2.friend.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetServiceVersionResult result = client.getServiceVersion(
new GetServiceVersionRequest()
);
String item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Friend.Request.GetServiceVersionRequest(),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2Friend.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_service_version(
friend.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_service_version({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_service_version_async({
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;dumpUserDataByUserId
Dump data associated with the specified user ID
Can be used to meet legal requirements for the protection of personal information, or to back up or migrate data.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&friend.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->dumpUserDataByUserId(
(new DumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DumpUserDataByUserIdRequest;
import io.gs2.friend.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Friend.Request.DumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Friend.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.dump_user_data_by_user_id(
friend.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('friend')
api_result_handler = client.dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultcheckDumpUserDataByUserId
Check if the dump of the data associated with the specified user ID is complete
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| url | string | URL of output data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&friend.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Urluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->checkDumpUserDataByUserId(
(new CheckDumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.friend.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
new CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Friend.Request.CheckDumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Friend.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
friend.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.check_dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;client = gs2('friend')
api_result_handler = client.check_dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;cleanUserDataByUserId
Delete user data
Execute cleaning of data associated with the specified user ID This allows you to safely delete specific user data from the project.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&friend.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->cleanUserDataByUserId(
(new CleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CleanUserDataByUserIdRequest;
import io.gs2.friend.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Friend.Request.CleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Friend.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.clean_user_data_by_user_id(
friend.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('friend')
api_result_handler = client.clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultcheckCleanUserDataByUserId
Check if the cleaning of the data associated with the specified user ID is complete
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&friend.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->checkCleanUserDataByUserId(
(new CheckCleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.friend.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Friend.Request.CheckCleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Friend.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
friend.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.check_clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('friend')
api_result_handler = client.check_clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultprepareImportUserDataByUserId
Execute import of data associated with the specified user ID
The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.
You can start the actual import process by uploading the exported zip file to the URL returned in the return value of this API and calling importUserDataByUserId.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload user data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&friend.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->prepareImportUserDataByUserId(
(new PrepareImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.friend.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
new PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Friend.Request.PrepareImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Friend.PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
friend.PrepareImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.prepare_import_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('friend')
api_result_handler = client.prepare_import_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;importUserDataByUserId
Execute import of data associated with the specified user ID
The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.
Before calling this API, you must call prepareImportUserDataByUserId to complete the upload preparation.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&friend.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->importUserDataByUserId(
(new ImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.ImportUserDataByUserIdRequest;
import io.gs2.friend.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
ImportUserDataByUserIdResult result = client.importUserDataByUserId(
new ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Friend.Request.ImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Friend.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.import_user_data_by_user_id(
friend.ImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('friend')
api_result_handler = client.import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultcheckImportUserDataByUserId
Check if the import of the data associated with the specified user ID is complete
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| url | string | URL of log data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&friend.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Urluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->checkImportUserDataByUserId(
(new CheckImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.CheckImportUserDataByUserIdRequest;
import io.gs2.friend.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
new CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Friend.Request.CheckImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Friend.CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
friend.CheckImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.check_import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;client = gs2('friend')
api_result_handler = client.check_import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;getProfile
Get profile
Retrieves the requesting user’s own profile, including all three visibility levels: public profile, follower profile, and friend profile.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token |
Result
| Type | Description | |
|---|---|---|
| item | Profile | Profile |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetProfile(
&friend.GetProfileRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetProfileRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getProfile(
(new GetProfileRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetProfileRequest;
import io.gs2.friend.result.GetProfileResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetProfileResult result = client.getProfile(
new GetProfileRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetProfileResult> asyncResult = null;
yield return client.GetProfile(
new Gs2.Gs2Friend.Request.GetProfileRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getProfile(
new Gs2Friend.GetProfileRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_profile(
friend.GetProfileRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_profile({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_profile_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getProfileByUserId
Get profile by specifying a user ID
Retrieves the specified user’s profile, including all three visibility levels (server-side operation).
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Profile | Profile |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetProfileByUserId(
&friend.GetProfileByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetProfileByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getProfileByUserId(
(new GetProfileByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetProfileByUserIdRequest;
import io.gs2.friend.result.GetProfileByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetProfileByUserIdResult result = client.getProfileByUserId(
new GetProfileByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetProfileByUserIdResult> asyncResult = null;
yield return client.GetProfileByUserId(
new Gs2.Gs2Friend.Request.GetProfileByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getProfileByUserId(
new Gs2Friend.GetProfileByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_profile_by_user_id(
friend.GetProfileByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_profile_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_profile_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateProfile
Update profile
Updates the requesting user’s profile with three distinct visibility levels:
- publicProfile: visible to all users
- followerProfile: visible only to users who follow this user
- friendProfile: visible only to users who are friends with this user
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| publicProfile | string | ~ 1024 chars | Public profile Profile information visible to all players regardless of relationship. Typically used for display names, avatars, or other publicly shareable information. | |||
| followerProfile | string | ~ 1024 chars | Profile for followers Profile information visible only to players who follow this user. Can contain more detailed information than the public profile, such as gameplay statistics or status messages. | |||
| friendProfile | string | ~ 1024 chars | Profile for friends Profile information visible only to players who have an established mutual friend relationship. The most private profile level, suitable for sharing personal information like contact details or private messages. |
Result
| Type | Description | |
|---|---|---|
| item | Profile | Profile updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.UpdateProfile(
&friend.UpdateProfileRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
PublicProfile: pointy.String("public"),
FollowerProfile: pointy.String("follower"),
FriendProfile: pointy.String("friend"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UpdateProfileRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->updateProfile(
(new UpdateProfileRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withPublicProfile("public")
->withFollowerProfile("follower")
->withFriendProfile("friend")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UpdateProfileRequest;
import io.gs2.friend.result.UpdateProfileResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UpdateProfileResult result = client.updateProfile(
new UpdateProfileRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPublicProfile("public")
.withFollowerProfile("follower")
.withFriendProfile("friend")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UpdateProfileResult> asyncResult = null;
yield return client.UpdateProfile(
new Gs2.Gs2Friend.Request.UpdateProfileRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithPublicProfile("public")
.WithFollowerProfile("follower")
.WithFriendProfile("friend"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.updateProfile(
new Gs2Friend.UpdateProfileRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPublicProfile("public")
.withFollowerProfile("follower")
.withFriendProfile("friend")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.update_profile(
friend.UpdateProfileRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_public_profile('public')
.with_follower_profile('follower')
.with_friend_profile('friend')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.update_profile({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
publicProfile="public",
followerProfile="follower",
friendProfile="friend",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.update_profile_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
publicProfile="public",
followerProfile="follower",
friendProfile="friend",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateProfileByUserId
Update profile by specifying a user ID
Updates the specified user’s profile with three distinct visibility levels (server-side operation):
- publicProfile: visible to all users
- followerProfile: visible only to followers
- friendProfile: visible only to friends
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| publicProfile | string | ~ 1024 chars | Public profile Profile information visible to all players regardless of relationship. Typically used for display names, avatars, or other publicly shareable information. | |||
| followerProfile | string | ~ 1024 chars | Profile for followers Profile information visible only to players who follow this user. Can contain more detailed information than the public profile, such as gameplay statistics or status messages. | |||
| friendProfile | string | ~ 1024 chars | Profile for friends Profile information visible only to players who have an established mutual friend relationship. The most private profile level, suitable for sharing personal information like contact details or private messages. | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Profile | Profile updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.UpdateProfileByUserId(
&friend.UpdateProfileByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
PublicProfile: pointy.String("public2"),
FollowerProfile: pointy.String("follower2"),
FriendProfile: pointy.String("friend2"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UpdateProfileByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->updateProfileByUserId(
(new UpdateProfileByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withPublicProfile("public2")
->withFollowerProfile("follower2")
->withFriendProfile("friend2")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UpdateProfileByUserIdRequest;
import io.gs2.friend.result.UpdateProfileByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UpdateProfileByUserIdResult result = client.updateProfileByUserId(
new UpdateProfileByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPublicProfile("public2")
.withFollowerProfile("follower2")
.withFriendProfile("friend2")
.withTimeOffsetToken(null)
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UpdateProfileByUserIdResult> asyncResult = null;
yield return client.UpdateProfileByUserId(
new Gs2.Gs2Friend.Request.UpdateProfileByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithPublicProfile("public2")
.WithFollowerProfile("follower2")
.WithFriendProfile("friend2")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.updateProfileByUserId(
new Gs2Friend.UpdateProfileByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPublicProfile("public2")
.withFollowerProfile("follower2")
.withFriendProfile("friend2")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.update_profile_by_user_id(
friend.UpdateProfileByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_public_profile('public2')
.with_follower_profile('follower2')
.with_friend_profile('friend2')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.update_profile_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
publicProfile="public2",
followerProfile="follower2",
friendProfile="friend2",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.update_profile_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
publicProfile="public2",
followerProfile="follower2",
friendProfile="friend2",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteProfileByUserId
Delete profile
Deletes the specified user’s profile data (server-side operation). All three visibility levels (public, follower, friend) of the profile are removed.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Profile | Profile deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DeleteProfileByUserId(
&friend.DeleteProfileByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteProfileByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->deleteProfileByUserId(
(new DeleteProfileByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteProfileByUserIdRequest;
import io.gs2.friend.result.DeleteProfileByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteProfileByUserIdResult result = client.deleteProfileByUserId(
new DeleteProfileByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteProfileByUserIdResult> asyncResult = null;
yield return client.DeleteProfileByUserId(
new Gs2.Gs2Friend.Request.DeleteProfileByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.deleteProfileByUserId(
new Gs2Friend.DeleteProfileByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.delete_profile_by_user_id(
friend.DeleteProfileByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.delete_profile_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.delete_profile_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeFriends
Get a list of friends
Retrieves a paginated list of the requesting user’s friends. Friendship is a bidirectional relationship established when a friend request is accepted. When withProfile is set to true, each friend’s profile information (visible to friends) is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<FriendUser> | List of Friend |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeFriends(
&friend.DescribeFriendsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
WithProfile: pointy.Bool(true),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFriendsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeFriends(
(new DescribeFriendsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withWithProfile(True)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFriendsRequest;
import io.gs2.friend.result.DescribeFriendsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeFriendsResult result = client.describeFriends(
new DescribeFriendsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
);
List<FriendUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFriendsResult> asyncResult = null;
yield return client.DescribeFriends(
new Gs2.Gs2Friend.Request.DescribeFriendsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithWithProfile(true)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeFriends(
new Gs2Friend.DescribeFriendsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_friends(
friend.DescribeFriendsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_with_profile(True)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_friends({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_friends_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeFriendsByUserId
Get a list of friends by specifying a user ID
Retrieves a paginated list of the specified user’s friends (server-side operation). When withProfile is set to true, each friend’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<FriendUser> | List of Friend |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeFriendsByUserId(
&friend.DescribeFriendsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
WithProfile: pointy.Bool(true),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFriendsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeFriendsByUserId(
(new DescribeFriendsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withWithProfile(True)
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFriendsByUserIdRequest;
import io.gs2.friend.result.DescribeFriendsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeFriendsByUserIdResult result = client.describeFriendsByUserId(
new DescribeFriendsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FriendUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFriendsByUserIdResult> asyncResult = null;
yield return client.DescribeFriendsByUserId(
new Gs2.Gs2Friend.Request.DescribeFriendsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithWithProfile(true)
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeFriendsByUserId(
new Gs2Friend.DescribeFriendsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_friends_by_user_id(
friend.DescribeFriendsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_with_profile(True)
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_friends_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_friends_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeBlackList
Get blacklist
Retrieves a paginated list of user IDs that the requesting user has blocked. Blocked users are prevented from sending friend requests or following the user. Returns only user IDs, not full user profiles.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<string> | Blacklisted user ID list |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeBlackList(
&friend.DescribeBlackListRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeBlackList(
(new DescribeBlackListRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeBlackListRequest;
import io.gs2.friend.result.DescribeBlackListResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeBlackListResult result = client.describeBlackList(
new DescribeBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
List<String> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeBlackListResult> asyncResult = null;
yield return client.DescribeBlackList(
new Gs2.Gs2Friend.Request.DescribeBlackListRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeBlackList(
new Gs2Friend.DescribeBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_black_list(
friend.DescribeBlackListRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_black_list({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_black_list_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeBlackListByUserId
Get blacklist by specifying a user ID
Retrieves a paginated list of user IDs that the specified user has blocked (server-side operation). Returns only user IDs, not full user profiles.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | 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 items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<string> | Blacklisted user ID list |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeBlackListByUserId(
&friend.DescribeBlackListByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeBlackListByUserId(
(new DescribeBlackListByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeBlackListByUserIdRequest;
import io.gs2.friend.result.DescribeBlackListByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeBlackListByUserIdResult result = client.describeBlackListByUserId(
new DescribeBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<String> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeBlackListByUserIdResult> asyncResult = null;
yield return client.DescribeBlackListByUserId(
new Gs2.Gs2Friend.Request.DescribeBlackListByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeBlackListByUserId(
new Gs2Friend.DescribeBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_black_list_by_user_id(
friend.DescribeBlackListByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_black_list_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_black_list_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;registerBlackList
Add to blacklist
Adds the specified target user to the requesting user’s blacklist. Once blocked, the target user will be unable to send friend requests or follow the user.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | BlackList | blacklist |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.RegisterBlackList(
&friend.RegisterBlackListRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RegisterBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->registerBlackList(
(new RegisterBlackListRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RegisterBlackListRequest;
import io.gs2.friend.result.RegisterBlackListResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
RegisterBlackListResult result = client.registerBlackList(
new RegisterBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.RegisterBlackListResult> asyncResult = null;
yield return client.RegisterBlackList(
new Gs2.Gs2Friend.Request.RegisterBlackListRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.registerBlackList(
new Gs2Friend.RegisterBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.register_black_list(
friend.RegisterBlackListRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.register_black_list({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.register_black_list_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;registerBlackListByUserId
Add to blacklist by specifying a user ID
Adds the specified target user to the specified user’s blacklist (server-side operation). Once blocked, the target user will be unable to send friend requests or follow the user.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | BlackList | blacklist |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.RegisterBlackListByUserId(
&friend.RegisterBlackListByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RegisterBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->registerBlackListByUserId(
(new RegisterBlackListByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RegisterBlackListByUserIdRequest;
import io.gs2.friend.result.RegisterBlackListByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
RegisterBlackListByUserIdResult result = client.registerBlackListByUserId(
new RegisterBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.RegisterBlackListByUserIdResult> asyncResult = null;
yield return client.RegisterBlackListByUserId(
new Gs2.Gs2Friend.Request.RegisterBlackListByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.registerBlackListByUserId(
new Gs2Friend.RegisterBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.register_black_list_by_user_id(
friend.RegisterBlackListByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.register_black_list_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.register_black_list_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;unregisterBlackList
Remove a user from blacklist
Removes the specified target user from the requesting user’s blacklist. After removal, the target user will be able to send friend requests and follow the user again.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | BlackList | Blacklist |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.UnregisterBlackList(
&friend.UnregisterBlackListRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UnregisterBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->unregisterBlackList(
(new UnregisterBlackListRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UnregisterBlackListRequest;
import io.gs2.friend.result.UnregisterBlackListResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnregisterBlackListResult result = client.unregisterBlackList(
new UnregisterBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnregisterBlackListResult> asyncResult = null;
yield return client.UnregisterBlackList(
new Gs2.Gs2Friend.Request.UnregisterBlackListRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.unregisterBlackList(
new Gs2Friend.UnregisterBlackListRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.unregister_black_list(
friend.UnregisterBlackListRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.unregister_black_list({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.unregister_black_list_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;unregisterBlackListByUserId
Remove a user from the blacklist by specifying a user ID
Removes the specified target user from the specified user’s blacklist (server-side operation). After removal, the target user will be able to send friend requests and follow the user again.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | BlackList | Blacklist |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.UnregisterBlackListByUserId(
&friend.UnregisterBlackListByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UnregisterBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->unregisterBlackListByUserId(
(new UnregisterBlackListByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UnregisterBlackListByUserIdRequest;
import io.gs2.friend.result.UnregisterBlackListByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnregisterBlackListByUserIdResult result = client.unregisterBlackListByUserId(
new UnregisterBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnregisterBlackListByUserIdResult> asyncResult = null;
yield return client.UnregisterBlackListByUserId(
new Gs2.Gs2Friend.Request.UnregisterBlackListByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.unregisterBlackListByUserId(
new Gs2Friend.UnregisterBlackListByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.unregister_black_list_by_user_id(
friend.UnregisterBlackListByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.unregister_black_list_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.unregister_black_list_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeFollows
Get a list of followed users
Retrieves a paginated list of users that the requesting user is following. When withProfile is set to true, each followed user’s profile information (visible to followers) is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<FollowUser> | List of users that the user follows |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeFollows(
&friend.DescribeFollowsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
WithProfile: pointy.Bool(true),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFollowsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeFollows(
(new DescribeFollowsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withWithProfile(True)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFollowsRequest;
import io.gs2.friend.result.DescribeFollowsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeFollowsResult result = client.describeFollows(
new DescribeFollowsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
);
List<FollowUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFollowsResult> asyncResult = null;
yield return client.DescribeFollows(
new Gs2.Gs2Friend.Request.DescribeFollowsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithWithProfile(true)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeFollows(
new Gs2Friend.DescribeFollowsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_follows(
friend.DescribeFollowsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_with_profile(True)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_follows({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_follows_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=true,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeFollowsByUserId
Get a list of followed users by specifying a user ID
Retrieves a paginated list of users that the specified user is following (server-side operation). When withProfile is set to true, each followed user’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<FollowUser> | List of users that the user follows |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeFollowsByUserId(
&friend.DescribeFollowsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
WithProfile: pointy.Bool(true),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeFollowsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeFollowsByUserId(
(new DescribeFollowsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withWithProfile(True)
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeFollowsByUserIdRequest;
import io.gs2.friend.result.DescribeFollowsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeFollowsByUserIdResult result = client.describeFollowsByUserId(
new DescribeFollowsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FollowUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFollowsByUserIdResult> asyncResult = null;
yield return client.DescribeFollowsByUserId(
new Gs2.Gs2Friend.Request.DescribeFollowsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithWithProfile(true)
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeFollowsByUserId(
new Gs2Friend.DescribeFollowsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(true)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_follows_by_user_id(
friend.DescribeFollowsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_with_profile(True)
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_follows_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_follows_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=true,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getFollow
Get a followed user
Retrieves information about a specific user that the requesting user is following. When withProfile is set to true, the followed user’s profile information (visible to followers) is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together |
Result
| Type | Description | |
|---|---|---|
| item | FollowUser | Following user |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetFollow(
&friend.GetFollowRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetFollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getFollow(
(new GetFollowRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetFollowRequest;
import io.gs2.friend.result.GetFollowResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFollowResult result = client.getFollow(
new GetFollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFollowResult> asyncResult = null;
yield return client.GetFollow(
new Gs2.Gs2Friend.Request.GetFollowRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getFollow(
new Gs2Friend.GetFollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_follow(
friend.GetFollowRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_follow({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_follow_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getFollowByUserId
Get a followed user by specifying a user ID
Retrieves information about a specific user that the specified user is following (server-side operation). When withProfile is set to true, the followed user’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FollowUser | Following user |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetFollowByUserId(
&friend.GetFollowByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetFollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getFollowByUserId(
(new GetFollowByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetFollowByUserIdRequest;
import io.gs2.friend.result.GetFollowByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFollowByUserIdResult result = client.getFollowByUserId(
new GetFollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFollowByUserIdResult> asyncResult = null;
yield return client.GetFollowByUserId(
new Gs2.Gs2Friend.Request.GetFollowByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getFollowByUserId(
new Gs2Friend.GetFollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_follow_by_user_id(
friend.GetFollowByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_follow_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_follow_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;follow
Follow a user
Adds the specified target user to the requesting user’s follow list. Following is a one-way relationship that does not require the target user’s approval. After following, the user can view the target user’s follower-level profile information.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to follow |
Result
| Type | Description | |
|---|---|---|
| item | FollowUser | Followed user |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.Follow(
&friend.FollowRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\FollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->follow(
(new FollowRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.FollowRequest;
import io.gs2.friend.result.FollowResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
FollowResult result = client.follow(
new FollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.FollowResult> asyncResult = null;
yield return client.Follow(
new Gs2.Gs2Friend.Request.FollowRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.follow(
new Gs2Friend.FollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.follow(
friend.FollowRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.follow({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.follow_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;followByUserId
Follow a user by specifying a user ID
Adds the specified target user to the specified user’s follow list (server-side operation). Following is a one-way relationship that does not require the target user’s approval.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to follow | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FollowUser | Followed user |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.FollowByUserId(
&friend.FollowByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\FollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->followByUserId(
(new FollowByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.FollowByUserIdRequest;
import io.gs2.friend.result.FollowByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
FollowByUserIdResult result = client.followByUserId(
new FollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.FollowByUserIdResult> asyncResult = null;
yield return client.FollowByUserId(
new Gs2.Gs2Friend.Request.FollowByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.followByUserId(
new Gs2Friend.FollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.follow_by_user_id(
friend.FollowByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.follow_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.follow_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;unfollow
Unfollow a user
Removes the specified target user from the requesting user’s follow list. After unfollowing, the user will no longer be able to view the target user’s follower-level profile information.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | FollowUser | Unfollowed user |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.Unfollow(
&friend.UnfollowRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UnfollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->unfollow(
(new UnfollowRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UnfollowRequest;
import io.gs2.friend.result.UnfollowResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnfollowResult result = client.unfollow(
new UnfollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnfollowResult> asyncResult = null;
yield return client.Unfollow(
new Gs2.Gs2Friend.Request.UnfollowRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.unfollow(
new Gs2Friend.UnfollowRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.unfollow(
friend.UnfollowRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.unfollow({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.unfollow_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;unfollowByUserId
Unfollow a user by specifying a user ID
Removes the specified target user from the specified user’s follow list (server-side operation). After unfollowing, the user will no longer be able to view the target user’s follower-level profile information.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FollowUser | Unfollowed user |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.UnfollowByUserId(
&friend.UnfollowByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\UnfollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->unfollowByUserId(
(new UnfollowByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.UnfollowByUserIdRequest;
import io.gs2.friend.result.UnfollowByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
UnfollowByUserIdResult result = client.unfollowByUserId(
new UnfollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnfollowByUserIdResult> asyncResult = null;
yield return client.UnfollowByUserId(
new Gs2.Gs2Friend.Request.UnfollowByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.unfollowByUserId(
new Gs2Friend.UnfollowByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.unfollow_by_user_id(
friend.UnfollowByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.unfollow_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.unfollow_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getFriend
Get a friend
Retrieves information about a specific friend of the requesting user. When withProfile is set to true, the friend’s profile information (visible to friends) is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together |
Result
| Type | Description | |
|---|---|---|
| item | FriendUser | Friend |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetFriend(
&friend.GetFriendRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getFriend(
(new GetFriendRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetFriendRequest;
import io.gs2.friend.result.GetFriendResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFriendResult result = client.getFriend(
new GetFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFriendResult> asyncResult = null;
yield return client.GetFriend(
new Gs2.Gs2Friend.Request.GetFriendRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getFriend(
new Gs2Friend.GetFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_friend(
friend.GetFriendRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_friend({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_friend_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=true,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getFriendByUserId
Get a friend by specifying a user ID
Retrieves information about a specific friend of the specified user (server-side operation). When withProfile is set to true, the friend’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendUser | Friend |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetFriendByUserId(
&friend.GetFriendByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: pointy.Bool(true),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getFriendByUserId(
(new GetFriendByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withWithProfile(True)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetFriendByUserIdRequest;
import io.gs2.friend.result.GetFriendByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetFriendByUserIdResult result = client.getFriendByUserId(
new GetFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFriendByUserIdResult> asyncResult = null;
yield return client.GetFriendByUserId(
new Gs2.Gs2Friend.Request.GetFriendByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(true)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getFriendByUserId(
new Gs2Friend.GetFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(true)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_friend_by_user_id(
friend.GetFriendByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_with_profile(True)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_friend_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_friend_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
withProfile=true,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;addFriend
Add friend
Directly adds the specified target user as a friend of the requesting user, bypassing the friend request flow. This creates a one-way friend relationship. The target user’s profile is always loaded and returned after adding.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | FriendUser | Added Friend |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.AddFriend(
&friend.AddFriendRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\AddFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->addFriend(
(new AddFriendRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.AddFriendRequest;
import io.gs2.friend.result.AddFriendResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AddFriendResult result = client.addFriend(
new AddFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.AddFriendResult> asyncResult = null;
yield return client.AddFriend(
new Gs2.Gs2Friend.Request.AddFriendRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.addFriend(
new Gs2Friend.AddFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.add_friend(
friend.AddFriendRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.add_friend({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.add_friend_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;addFriendByUserId
Add friend by specifying a user ID
Directly adds the specified target user as a friend of the specified user, bypassing the friend request flow (server-side operation). This creates a one-way friend relationship.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendUser | Added Friend |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.AddFriendByUserId(
&friend.AddFriendByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\AddFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->addFriendByUserId(
(new AddFriendByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.AddFriendByUserIdRequest;
import io.gs2.friend.result.AddFriendByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AddFriendByUserIdResult result = client.addFriendByUserId(
new AddFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.AddFriendByUserIdResult> asyncResult = null;
yield return client.AddFriendByUserId(
new Gs2.Gs2Friend.Request.AddFriendByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.addFriendByUserId(
new Gs2Friend.AddFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.add_friend_by_user_id(
friend.AddFriendByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.add_friend_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.add_friend_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteFriend
Delete friend
Removes the specified target user from the requesting user’s friend list. The target user’s profile is loaded before deletion, and the deleted friend information is returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | FriendUser | Friend deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DeleteFriend(
&friend.DeleteFriendRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->deleteFriend(
(new DeleteFriendRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteFriendRequest;
import io.gs2.friend.result.DeleteFriendResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteFriendResult result = client.deleteFriend(
new DeleteFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteFriendResult> asyncResult = null;
yield return client.DeleteFriend(
new Gs2.Gs2Friend.Request.DeleteFriendRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.deleteFriend(
new Gs2Friend.DeleteFriendRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.delete_friend(
friend.DeleteFriendRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.delete_friend({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.delete_friend_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteFriendByUserId
Delete friend by specifying a user ID
Removes the specified target user from the specified user’s friend list (server-side operation). The deleted friend information is returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendUser | Friend deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DeleteFriendByUserId(
&friend.DeleteFriendByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->deleteFriendByUserId(
(new DeleteFriendByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteFriendByUserIdRequest;
import io.gs2.friend.result.DeleteFriendByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteFriendByUserIdResult result = client.deleteFriendByUserId(
new DeleteFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteFriendByUserIdResult> asyncResult = null;
yield return client.DeleteFriendByUserId(
new Gs2.Gs2Friend.Request.DeleteFriendByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.deleteFriendByUserId(
new Gs2Friend.DeleteFriendByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.delete_friend_by_user_id(
friend.DeleteFriendByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.delete_friend_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.delete_friend_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeSendRequests
Get a list of sent friend requests
Retrieves a paginated list of friend requests that the requesting user has sent and are pending a response. When withProfile is set to true, the target user’s profile information is also loaded and returned for each request.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<FriendRequest> | List of Friend Request |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeSendRequests(
&friend.DescribeSendRequestsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeSendRequestsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeSendRequests(
(new DescribeSendRequestsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withWithProfile(null)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeSendRequestsRequest;
import io.gs2.friend.result.DescribeSendRequestsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeSendRequestsResult result = client.describeSendRequests(
new DescribeSendRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeSendRequestsResult> asyncResult = null;
yield return client.DescribeSendRequests(
new Gs2.Gs2Friend.Request.DescribeSendRequestsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithWithProfile(null)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeSendRequests(
new Gs2Friend.DescribeSendRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_send_requests(
friend.DescribeSendRequestsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_with_profile(None)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_send_requests({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_send_requests_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeSendRequestsByUserId
Get a list of sent friend requests by specifying a user ID
Retrieves a paginated list of friend requests that the specified user has sent (server-side operation). When withProfile is set to true, the target user’s profile information is also loaded and returned for each request.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<FriendRequest> | List of Friend Request |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeSendRequestsByUserId(
&friend.DescribeSendRequestsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeSendRequestsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeSendRequestsByUserId(
(new DescribeSendRequestsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withWithProfile(null)
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeSendRequestsByUserIdRequest;
import io.gs2.friend.result.DescribeSendRequestsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeSendRequestsByUserIdResult result = client.describeSendRequestsByUserId(
new DescribeSendRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeSendRequestsByUserIdResult> asyncResult = null;
yield return client.DescribeSendRequestsByUserId(
new Gs2.Gs2Friend.Request.DescribeSendRequestsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithWithProfile(null)
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeSendRequestsByUserId(
new Gs2Friend.DescribeSendRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_send_requests_by_user_id(
friend.DescribeSendRequestsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_with_profile(None)
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_send_requests_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_send_requests_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getSendRequest
Get a sent friend request
Retrieves a specific friend request that the requesting user has sent to the specified target user. When withProfile is set to true, the target user’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Friend Request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetSendRequest(
&friend.GetSendRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetSendRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getSendRequest(
(new GetSendRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
->withWithProfile(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetSendRequestRequest;
import io.gs2.friend.result.GetSendRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetSendRequestResult result = client.getSendRequest(
new GetSendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetSendRequestResult> asyncResult = null;
yield return client.GetSendRequest(
new Gs2.Gs2Friend.Request.GetSendRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getSendRequest(
new Gs2Friend.GetSendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_send_request(
friend.GetSendRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
.with_with_profile(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_send_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_send_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getSendRequestByUserId
Get a sent friend request by specifying a user ID
Retrieves a specific friend request that the specified user has sent to the specified target user (server-side operation). When withProfile is set to true, the target user’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Friend Request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetSendRequestByUserId(
&friend.GetSendRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
WithProfile: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetSendRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getSendRequestByUserId(
(new GetSendRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withWithProfile(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetSendRequestByUserIdRequest;
import io.gs2.friend.result.GetSendRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetSendRequestByUserIdResult result = client.getSendRequestByUserId(
new GetSendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withWithProfile(null)
.withTimeOffsetToken(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetSendRequestByUserIdResult> asyncResult = null;
yield return client.GetSendRequestByUserId(
new Gs2.Gs2Friend.Request.GetSendRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithWithProfile(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getSendRequestByUserId(
new Gs2Friend.GetSendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withWithProfile(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_send_request_by_user_id(
friend.GetSendRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_with_profile(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_send_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
withProfile=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_send_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
withProfile=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;sendRequest
Send a friend request
Sends a friend request to the specified target user. You cannot send a request to yourself.
If the number of “current friends” reaches 1000, you cannot send a new request. If there is one or more “unaccepted friend requests”, the oldest “unaccepted friend request” will be withdrawn and a new request will be sent.
And, if the recipient of the friend request has 1000 “unaccepted friend requests”, the oldest “unaccepted friend request” will be withdrawn and a new request will be accepted.
When withProfile is set to true, the target user’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to be friend | ||
| withProfile | bool | false | Get a profile together |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Sent Friend Request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.SendRequest(
&friend.SendRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\SendRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->sendRequest(
(new SendRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
->withWithProfile(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.SendRequestRequest;
import io.gs2.friend.result.SendRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
SendRequestResult result = client.sendRequest(
new SendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.SendRequestResult> asyncResult = null;
yield return client.SendRequest(
new Gs2.Gs2Friend.Request.SendRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002")
.WithWithProfile(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.sendRequest(
new Gs2Friend.SendRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.send_request(
friend.SendRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
.with_with_profile(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.send_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.send_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
withProfile=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;sendRequestByUserId
Send a friend request by specifying a user ID
Sends a friend request to the specified target user on behalf of the specified user (server-side operation). You cannot send a request to yourself.
If the number of “current friends” reaches 1000, you cannot send a new request. If there is one or more “unaccepted friend requests”, the oldest “unaccepted friend request” will be withdrawn and a new request will be sent.
And, if the recipient of the friend request has 1000 “unaccepted friend requests”, the oldest “unaccepted friend request” will be withdrawn and a new request will be accepted.
When withProfile is set to true, the target user’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to be friend | ||
| withProfile | bool | false | Get a profile together | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Sent Friend Request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.SendRequestByUserId(
&friend.SendRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
WithProfile: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\SendRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->sendRequestByUserId(
(new SendRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withWithProfile(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.SendRequestByUserIdRequest;
import io.gs2.friend.result.SendRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
SendRequestByUserIdResult result = client.sendRequestByUserId(
new SendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withWithProfile(null)
.withTimeOffsetToken(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.SendRequestByUserIdResult> asyncResult = null;
yield return client.SendRequestByUserId(
new Gs2.Gs2Friend.Request.SendRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithWithProfile(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.sendRequestByUserId(
new Gs2Friend.SendRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withWithProfile(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.send_request_by_user_id(
friend.SendRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_with_profile(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.send_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
withProfile=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.send_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
withProfile=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteRequest
Cancel a sent friend request
Cancels (deletes) a friend request that the requesting user has previously sent to the specified target user. The request is removed from both the sender’s sent box and the recipient’s inbox.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Friend Request deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DeleteRequest(
&friend.DeleteRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->deleteRequest(
(new DeleteRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withTargetUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteRequestRequest;
import io.gs2.friend.result.DeleteRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteRequestResult result = client.deleteRequest(
new DeleteRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteRequestResult> asyncResult = null;
yield return client.DeleteRequest(
new Gs2.Gs2Friend.Request.DeleteRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithTargetUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.deleteRequest(
new Gs2Friend.DeleteRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withTargetUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.delete_request(
friend.DeleteRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.delete_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.delete_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
targetUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteRequestByUserId
Cancel a sent friend request by specifying a user ID
Cancels (deletes) a friend request that the specified user has previously sent to the specified target user (server-side operation). The request is removed from both the sender’s sent box and the recipient’s inbox.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| targetUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Friend Request deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DeleteRequestByUserId(
&friend.DeleteRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DeleteRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->deleteRequestByUserId(
(new DeleteRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTargetUserId(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DeleteRequestByUserIdRequest;
import io.gs2.friend.result.DeleteRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DeleteRequestByUserIdResult result = client.deleteRequestByUserId(
new DeleteRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteRequestByUserIdResult> asyncResult = null;
yield return client.DeleteRequestByUserId(
new Gs2.Gs2Friend.Request.DeleteRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTargetUserId(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.deleteRequestByUserId(
new Gs2Friend.DeleteRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTargetUserId(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.delete_request_by_user_id(
friend.DeleteRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_target_user_id(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.delete_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.delete_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
targetUserId=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeReceiveRequests
Get a list of received friend requests
Retrieves a paginated list of friend requests that have been sent to the requesting user and are pending acceptance or rejection. When withProfile is set to true, the sender’s profile information is also loaded and returned for each request.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<FriendRequest> | List of Friend request |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeReceiveRequests(
&friend.DescribeReceiveRequestsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeReceiveRequestsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeReceiveRequests(
(new DescribeReceiveRequestsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withWithProfile(null)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeReceiveRequestsRequest;
import io.gs2.friend.result.DescribeReceiveRequestsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeReceiveRequestsResult result = client.describeReceiveRequests(
new DescribeReceiveRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeReceiveRequestsResult> asyncResult = null;
yield return client.DescribeReceiveRequests(
new Gs2.Gs2Friend.Request.DescribeReceiveRequestsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithWithProfile(null)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeReceiveRequests(
new Gs2Friend.DescribeReceiveRequestsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_receive_requests(
friend.DescribeReceiveRequestsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_with_profile(None)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_receive_requests({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_receive_requests_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeReceiveRequestsByUserId
Get a list of received friend requests by specifying a user ID
Retrieves a paginated list of friend requests that have been sent to the specified user (server-side operation). When withProfile is set to true, the sender’s profile information is also loaded and returned for each request.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<FriendRequest> | List of Friend request |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.DescribeReceiveRequestsByUserId(
&friend.DescribeReceiveRequestsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\DescribeReceiveRequestsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->describeReceiveRequestsByUserId(
(new DescribeReceiveRequestsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withWithProfile(null)
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.DescribeReceiveRequestsByUserIdRequest;
import io.gs2.friend.result.DescribeReceiveRequestsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
DescribeReceiveRequestsByUserIdResult result = client.describeReceiveRequestsByUserId(
new DescribeReceiveRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeReceiveRequestsByUserIdResult> asyncResult = null;
yield return client.DescribeReceiveRequestsByUserId(
new Gs2.Gs2Friend.Request.DescribeReceiveRequestsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithWithProfile(null)
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.describeReceiveRequestsByUserId(
new Gs2Friend.DescribeReceiveRequestsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.describe_receive_requests_by_user_id(
friend.DescribeReceiveRequestsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_with_profile(None)
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.describe_receive_requests_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('friend')
api_result_handler = client.describe_receive_requests_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
withProfile=nil,
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getReceiveRequest
Get a received friend request
Retrieves a specific friend request sent by the specified sender to the requesting user. When withProfile is set to true, the sender’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| fromUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Friend request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetReceiveRequest(
&friend.GetReceiveRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
FromUserId: pointy.String("user-0002"),
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetReceiveRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getReceiveRequest(
(new GetReceiveRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withFromUserId("user-0002")
->withWithProfile(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetReceiveRequestRequest;
import io.gs2.friend.result.GetReceiveRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetReceiveRequestResult result = client.getReceiveRequest(
new GetReceiveRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
.withWithProfile(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetReceiveRequestResult> asyncResult = null;
yield return client.GetReceiveRequest(
new Gs2.Gs2Friend.Request.GetReceiveRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithFromUserId("user-0002")
.WithWithProfile(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getReceiveRequest(
new Gs2Friend.GetReceiveRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
.withWithProfile(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_receive_request(
friend.GetReceiveRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_from_user_id('user-0002')
.with_with_profile(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_receive_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_receive_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
withProfile=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getReceiveRequestByUserId
Get a received friend request by specifying a user ID
Retrieves a specific friend request sent by the specified sender to the specified user (server-side operation). When withProfile is set to true, the sender’s profile information is also loaded and returned.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| fromUserId | string | ✓ | ~ 128 chars | User ID | ||
| withProfile | bool | false | Get a profile together | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Friend request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetReceiveRequestByUserId(
&friend.GetReceiveRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
FromUserId: pointy.String("user-0002"),
WithProfile: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetReceiveRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getReceiveRequestByUserId(
(new GetReceiveRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withFromUserId("user-0002")
->withWithProfile(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetReceiveRequestByUserIdRequest;
import io.gs2.friend.result.GetReceiveRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetReceiveRequestByUserIdResult result = client.getReceiveRequestByUserId(
new GetReceiveRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withWithProfile(null)
.withTimeOffsetToken(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetReceiveRequestByUserIdResult> asyncResult = null;
yield return client.GetReceiveRequestByUserId(
new Gs2.Gs2Friend.Request.GetReceiveRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithFromUserId("user-0002")
.WithWithProfile(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getReceiveRequestByUserId(
new Gs2Friend.GetReceiveRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withWithProfile(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_receive_request_by_user_id(
friend.GetReceiveRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_from_user_id('user-0002')
.with_with_profile(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_receive_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
withProfile=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_receive_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
withProfile=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;acceptRequest
Accept friend request
Accepts a pending friend request from the specified sender. Upon acceptance, a bidirectional friend relationship is established between both users, and the friend request is marked as accepted. Both users will appear in each other’s friend lists and can view each other’s friend-level profile information.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| fromUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Accepted Friend Request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.AcceptRequest(
&friend.AcceptRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
FromUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\AcceptRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->acceptRequest(
(new AcceptRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withFromUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.AcceptRequestRequest;
import io.gs2.friend.result.AcceptRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AcceptRequestResult result = client.acceptRequest(
new AcceptRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.AcceptRequestResult> asyncResult = null;
yield return client.AcceptRequest(
new Gs2.Gs2Friend.Request.AcceptRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithFromUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.acceptRequest(
new Gs2Friend.AcceptRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.accept_request(
friend.AcceptRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_from_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.accept_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.accept_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;acceptRequestByUserId
Accept friend request by specifying a user ID
Accepts a pending friend request from the specified sender for the specified user (server-side operation). Upon acceptance, a bidirectional friend relationship is established between both users.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| fromUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Accepted Friend Request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.AcceptRequestByUserId(
&friend.AcceptRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
FromUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\AcceptRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->acceptRequestByUserId(
(new AcceptRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withFromUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.AcceptRequestByUserIdRequest;
import io.gs2.friend.result.AcceptRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
AcceptRequestByUserIdResult result = client.acceptRequestByUserId(
new AcceptRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.AcceptRequestByUserIdResult> asyncResult = null;
yield return client.AcceptRequestByUserId(
new Gs2.Gs2Friend.Request.AcceptRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithFromUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.acceptRequestByUserId(
new Gs2Friend.AcceptRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.accept_request_by_user_id(
friend.AcceptRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_from_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.accept_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.accept_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;rejectRequest
Reject friend request
Rejects a pending friend request from the specified sender. The friend request is marked as rejected and deleted. No friend relationship is established.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| fromUserId | string | ✓ | ~ 128 chars | User ID |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Rejected friend request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.RejectRequest(
&friend.RejectRequestRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
FromUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RejectRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->rejectRequest(
(new RejectRequestRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withFromUserId("user-0002")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RejectRequestRequest;
import io.gs2.friend.result.RejectRequestResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
RejectRequestResult result = client.rejectRequest(
new RejectRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.RejectRequestResult> asyncResult = null;
yield return client.RejectRequest(
new Gs2.Gs2Friend.Request.RejectRequestRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithFromUserId("user-0002"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.rejectRequest(
new Gs2Friend.RejectRequestRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withFromUserId("user-0002")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.reject_request(
friend.RejectRequestRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_from_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.reject_request({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.reject_request_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
fromUserId="user-0002",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;rejectRequestByUserId
Reject friend request by specifying a user ID
Rejects a pending friend request from the specified sender for the specified user (server-side operation). The friend request is marked as rejected and deleted. No friend relationship is established.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| fromUserId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | FriendRequest | Rejected friend request |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.RejectRequestByUserId(
&friend.RejectRequestByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
FromUserId: pointy.String("user-0002"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\RejectRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->rejectRequestByUserId(
(new RejectRequestByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withFromUserId("user-0002")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.RejectRequestByUserIdRequest;
import io.gs2.friend.result.RejectRequestByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
RejectRequestByUserIdResult result = client.rejectRequestByUserId(
new RejectRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.RejectRequestByUserIdResult> asyncResult = null;
yield return client.RejectRequestByUserId(
new Gs2.Gs2Friend.Request.RejectRequestByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithFromUserId("user-0002")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.rejectRequestByUserId(
new Gs2Friend.RejectRequestByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withFromUserId("user-0002")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.reject_request_by_user_id(
friend.RejectRequestByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_from_user_id('user-0002')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.reject_request_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.reject_request_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
fromUserId="user-0002",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getPublicProfile
Get public profile
Retrieves only the public portion of the specified user’s profile. This is the profile information that is visible to all users, regardless of follow or friend status. Unlike GetProfile, this does not require any relationship with the target user.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | PublicProfile | Public Profile |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/friend"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := friend.Gs2FriendRestClient{
Session: &session,
}
result, err := client.GetPublicProfile(
&friend.GetPublicProfileRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Friend\Gs2FriendRestClient;
use Gs2\Friend\Request\GetPublicProfileRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2FriendRestClient(
$session
);
try {
$result = $client->getPublicProfile(
(new GetPublicProfileRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.friend.rest.Gs2FriendRestClient;
import io.gs2.friend.request.GetPublicProfileRequest;
import io.gs2.friend.result.GetPublicProfileResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2FriendRestClient client = new Gs2FriendRestClient(session);
try {
GetPublicProfileResult result = client.getPublicProfile(
new GetPublicProfileRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
PublicProfile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetPublicProfileResult> asyncResult = null;
yield return client.GetPublicProfile(
new Gs2.Gs2Friend.Request.GetPublicProfileRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Friend from '@/gs2/friend';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Friend.Gs2FriendRestClient(session);
try {
const result = await client.getPublicProfile(
new Gs2Friend.GetPublicProfileRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import friend
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = friend.Gs2FriendRestClient(session)
try:
result = client.get_public_profile(
friend.GetPublicProfileRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('friend')
api_result = client.get_public_profile({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('friend')
api_result_handler = client.get_public_profile_async({
namespaceName="namespace-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;