GS2-Friend
GS2 SDK Reference
GS2 SDK Reference
Models
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project.
Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
Type | Description | |
---|---|---|
namespaceId | string | Namespace GRN |
name | string | Namespace name |
description | string | description of Namespace |
followScript | ScriptSetting | Script to run when followed |
unfollowScript | ScriptSetting | Script to run when unfollowed |
sendRequestScript | ScriptSetting | Script to run when a friend request is issued |
cancelRequestScript | ScriptSetting | Script to execute when a friend request is canceled |
acceptRequestScript | ScriptSetting | Script to run when a friend request is accepted |
rejectRequestScript | ScriptSetting | Script to execute when a friend request is rejected |
deleteFriendScript | ScriptSetting | Script to run when a friend is deleted |
updateProfileScript | ScriptSetting | Script to run when you update your profile |
followNotification | NotificationSetting | Push notification when you are followed |
receiveRequestNotification | NotificationSetting | Push notification when a friend request is received |
acceptRequestNotification | NotificationSetting | Push notification when a friend request is approved |
logSetting | LogSetting | Log output settings |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
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
Type | Description | |
---|---|---|
profileId | string | Profile GRN |
userId | string | User Id |
publicProfile | string | Public profile |
followerProfile | string | Profile for followers |
friendProfile | string | Profile for friends |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
Follow
Follow
A follow is a unidirectional relationship between game players.
The relationship is established immediately upon sending a follow request.
Type | Description | |
---|---|---|
followId | string | Follow GRN |
userId | string | User Id |
targetUserIds | string[] | List of user IDs you are following |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
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.
Type | Description | |
---|---|---|
friendId | string | Friend GRN |
userId | string | User Id |
targetUserIds | string[] | User ID list of friends |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
SendBox
Type | Description | |
---|---|---|
sendBoxId | string | SendBox GRN |
userId | string | User Id |
targetUserIds | string[] | Destination user ID list for friend requests |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
Inbox
Type | Description | |
---|---|---|
inboxId | string | Inbox GRN |
userId | string | User Id |
fromUserIds | string[] | List of user IDs who have sent friend requests |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
BlackList
Type | Description | |
---|---|---|
blackListId | string | Blacklist GRN |
userId | string | User Id |
targetUserIds | string[] | Blacklist user ID list |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
FollowUser
Type | Description | |
---|---|---|
userId | string | User Id |
publicProfile | string | Public profile |
followerProfile | string | Profile for followers |
FriendUser
Type | Description | |
---|---|---|
userId | string | User Id |
publicProfile | string | Public profile |
friendProfile | string | Profile for friends |
FriendRequest
Type | Description | |
---|---|---|
userId | string | Sender |
targetUserId | string | Target |
SendFriendRequest
Type | Description | |
---|---|---|
userId | string | Sent |
targetUserId | string | Target |
ReceiveFriendRequest
Type | Description | |
---|---|---|
userId | string | Sent |
targetUserId | string | Target |
PublicProfile
Type | Description | |
---|---|---|
userId | string | User Id |
publicProfile | string | Public profile |
ScriptSetting
Type | Description | |
---|---|---|
triggerScriptId | string | Script GRN |
doneTriggerTargetType | enum ['none', 'gs2_script', 'aws'] | Notification of Completion |
doneTriggerScriptId | string | Script GRN |
doneTriggerQueueNamespaceId | string | Namespace GRN |
NotificationSetting
Type | Description | |
---|---|---|
gatewayNamespaceId | string | Namespace GRN |
enableTransferMobileNotification | bool | Forwarding to mobile push notification |
sound | string | Sound file name to be used for mobile push notifications |
LogSetting
Type | Description | |
---|---|---|
loggingNamespaceId | string | Namespace GRN |
Methods
describeNamespaces
describeNamespaces
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 {
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->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()
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeNamespacesRequest;
using Gs2.Gs2Friend.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Friend.Request.DescribeNamespacesRequest()
.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()
.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_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({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of namespaces
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | Namespace[] | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
createNamespace
createNamespace
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("namespace1"),
Description: nil,
FollowScript: nil,
UnfollowScript: nil,
SendRequestScript: nil,
CancelRequestScript: nil,
AcceptRequestScript: nil,
RejectRequestScript: nil,
DeleteFriendScript: nil,
UpdateProfileScript: nil,
FollowNotification: nil,
ReceiveRequestNotification: nil,
AcceptRequestNotification: nil,
LogSetting: &friend.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName(self::namespace1)
->withDescription(null)
->withFollowScript(null)
->withUnfollowScript(null)
->withSendRequestScript(null)
->withCancelRequestScript(null)
->withAcceptRequestScript(null)
->withRejectRequestScript(null)
->withDeleteFriendScript(null)
->withUpdateProfileScript(null)
->withFollowNotification(null)
->withReceiveRequestNotification(null)
->withAcceptRequestNotification(null)
->withLogSetting((new \Gs2\Friend\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$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("namespace1")
.withDescription(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withAcceptRequestNotification(null)
.withLogSetting(new io.gs2.friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.CreateNamespaceRequest;
using Gs2.Gs2Friend.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Friend.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithFollowScript(null)
.WithUnfollowScript(null)
.WithSendRequestScript(null)
.WithCancelRequestScript(null)
.WithAcceptRequestScript(null)
.WithRejectRequestScript(null)
.WithDeleteFriendScript(null)
.WithUpdateProfileScript(null)
.WithFollowNotification(null)
.WithReceiveRequestNotification(null)
.WithAcceptRequestNotification(null)
.WithLogSetting(new Gs2.Gs2Friend.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
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("namespace1")
.withDescription(null)
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withAcceptRequestNotification(null)
.withLogSetting(new Gs2Friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
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(self.hash1)
.with_description(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_accept_request_notification(None)
.with_log_setting(
friend.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.create_namespace({
name='namespace1',
description=nil,
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
acceptRequestNotification=nil,
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Create a new namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
followScript | ScriptSetting | Script to run when followed | |||
unfollowScript | ScriptSetting | Script to run when unfollowed | |||
sendRequestScript | ScriptSetting | Script to run when a friend request is issued | |||
cancelRequestScript | ScriptSetting | Script to execute when a friend request is canceled | |||
acceptRequestScript | ScriptSetting | Script to run when a friend request is accepted | |||
rejectRequestScript | ScriptSetting | Script to execute when a friend request is rejected | |||
deleteFriendScript | ScriptSetting | Script to run when a friend is deleted | |||
updateProfileScript | ScriptSetting | Script to run when you update your profile | |||
followNotification | NotificationSetting | Push notification when you are followed | |||
receiveRequestNotification | NotificationSetting | Push notification when a friend request is received | |||
acceptRequestNotification | NotificationSetting | Push notification when a friend request is approved | |||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
getNamespaceStatus
getNamespaceStatus
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("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Status
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\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName(self::namespace1)
);
$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("namespace1")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Friend.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Friend.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace1"),
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("namespace1")
);
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(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_namespace_status({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
Get namespace status
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
getNamespace
getNamespace
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("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$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("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetNamespaceRequest;
using Gs2.Gs2Friend.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Friend.Request.GetNamespaceRequest()
.WithNamespaceName("namespace1"),
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("namespace1")
);
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(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
updateNamespace
updateNamespace
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("namespace1"),
Description: pointy.String("description1"),
FollowScript: nil,
UnfollowScript: nil,
SendRequestScript: nil,
CancelRequestScript: nil,
AcceptRequestScript: nil,
RejectRequestScript: nil,
DeleteFriendScript: nil,
UpdateProfileScript: nil,
FollowNotification: nil,
ReceiveRequestNotification: nil,
AcceptRequestNotification: nil,
LogSetting: &friend.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName(self::namespace1)
->withDescription("description1")
->withFollowScript(null)
->withUnfollowScript(null)
->withSendRequestScript(null)
->withCancelRequestScript(null)
->withAcceptRequestScript(null)
->withRejectRequestScript(null)
->withDeleteFriendScript(null)
->withUpdateProfileScript(null)
->withFollowNotification(null)
->withReceiveRequestNotification(null)
->withAcceptRequestNotification(null)
->withLogSetting((new \Gs2\Friend\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$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("namespace1")
.withDescription("description1")
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withAcceptRequestNotification(null)
.withLogSetting(new io.gs2.friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UpdateNamespaceRequest;
using Gs2.Gs2Friend.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Friend.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithFollowScript(null)
.WithUnfollowScript(null)
.WithSendRequestScript(null)
.WithCancelRequestScript(null)
.WithAcceptRequestScript(null)
.WithRejectRequestScript(null)
.WithDeleteFriendScript(null)
.WithUpdateProfileScript(null)
.WithFollowNotification(null)
.WithReceiveRequestNotification(null)
.WithAcceptRequestNotification(null)
.WithLogSetting(new Gs2.Gs2Friend.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
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("namespace1")
.withDescription("description1")
.withFollowScript(null)
.withUnfollowScript(null)
.withSendRequestScript(null)
.withCancelRequestScript(null)
.withAcceptRequestScript(null)
.withRejectRequestScript(null)
.withDeleteFriendScript(null)
.withUpdateProfileScript(null)
.withFollowNotification(null)
.withReceiveRequestNotification(null)
.withAcceptRequestNotification(null)
.withLogSetting(new Gs2Friend.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
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(self.hash1)
.with_description('description1')
.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_accept_request_notification(None)
.with_log_setting(
friend.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.update_namespace({
namespaceName='namespace1',
description='description1',
followScript=nil,
unfollowScript=nil,
sendRequestScript=nil,
cancelRequestScript=nil,
acceptRequestScript=nil,
rejectRequestScript=nil,
deleteFriendScript=nil,
updateProfileScript=nil,
followNotification=nil,
receiveRequestNotification=nil,
acceptRequestNotification=nil,
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Update namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
followScript | ScriptSetting | Script to run when followed | |||
unfollowScript | ScriptSetting | Script to run when unfollowed | |||
sendRequestScript | ScriptSetting | Script to run when a friend request is issued | |||
cancelRequestScript | ScriptSetting | Script to execute when a friend request is canceled | |||
acceptRequestScript | ScriptSetting | Script to run when a friend request is accepted | |||
rejectRequestScript | ScriptSetting | Script to execute when a friend request is rejected | |||
deleteFriendScript | ScriptSetting | Script to run when a friend is deleted | |||
updateProfileScript | ScriptSetting | Script to run when you update your profile | |||
followNotification | NotificationSetting | Push notification when you are followed | |||
receiveRequestNotification | NotificationSetting | Push notification when a friend request is received | |||
acceptRequestNotification | NotificationSetting | Push notification when a friend request is approved | |||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
deleteNamespace
deleteNamespace
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("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$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("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteNamespaceRequest;
using Gs2.Gs2Friend.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Friend.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace1"),
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("namespace1")
);
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(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Deleted namespace |
getProfile
getProfile
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetProfileRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getProfile(
(new GetProfileRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
);
$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("namespace2")
.withAccessToken("$access_token_0001")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetProfileRequest;
using Gs2.Gs2Friend.Result.GetProfileResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetProfileResult> asyncResult = null;
yield return client.GetProfile(
new Gs2.Gs2Friend.Request.GetProfileRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_0001)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_profile({
namespaceName='namespace2',
accessToken='$access_token_0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get Profile
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | Profile | Profile |
getProfileByUserId
getProfileByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetProfileByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getProfileByUserId(
(new GetProfileByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetProfileByUserIdRequest;
using Gs2.Gs2Friend.Result.GetProfileByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetProfileByUserIdResult> asyncResult = null;
yield return client.GetProfileByUserId(
new Gs2.Gs2Friend.Request.GetProfileByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.getProfileByUserId(
new Gs2Friend.GetProfileByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_by_user_id(
friend.GetProfileByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_profile_by_user_id({
namespaceName='namespace2',
userId='user-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get profile by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | Profile | Profile |
updateProfile
updateProfile
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
PublicProfile: pointy.String("public"),
FollowerProfile: pointy.String("follower"),
FriendProfile: pointy.String("friend"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UpdateProfileRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateProfile(
(new UpdateProfileRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withPublicProfile("public")
.withFollowerProfile("follower")
.withFriendProfile("friend")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UpdateProfileRequest;
using Gs2.Gs2Friend.Result.UpdateProfileResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UpdateProfileResult> asyncResult = null;
yield return client.UpdateProfile(
new Gs2.Gs2Friend.Request.UpdateProfileRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
publicProfile='public',
followerProfile='follower',
friendProfile='friend',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Update Profile
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
publicProfile | string | ~ 1024 chars | Public profile | ||
followerProfile | string | ~ 1024 chars | Profile for followers | ||
friendProfile | string | ~ 1024 chars | Profile for friends |
Result
Type | Description | |
---|---|---|
item | Profile | Updated Profile |
updateProfileByUserId
updateProfileByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
PublicProfile: pointy.String("public2"),
FollowerProfile: pointy.String("follower2"),
FriendProfile: pointy.String("friend2"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UpdateProfileByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateProfileByUserId(
(new UpdateProfileByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withPublicProfile("public2")
->withFollowerProfile("follower2")
->withFriendProfile("friend2")
);
$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("namespace2")
.withUserId("user-0001")
.withPublicProfile("public2")
.withFollowerProfile("follower2")
.withFriendProfile("friend2")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UpdateProfileByUserIdRequest;
using Gs2.Gs2Friend.Result.UpdateProfileByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UpdateProfileByUserIdResult> asyncResult = null;
yield return client.UpdateProfileByUserId(
new Gs2.Gs2Friend.Request.UpdateProfileByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithPublicProfile("public2")
.WithFollowerProfile("follower2")
.WithFriendProfile("friend2"),
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("namespace2")
.withUserId("user-0001")
.withPublicProfile("public2")
.withFollowerProfile("follower2")
.withFriendProfile("friend2")
);
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(self.hash2)
.with_user_id('user-0001')
.with_public_profile('public2')
.with_follower_profile('follower2')
.with_friend_profile('friend2')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.update_profile_by_user_id({
namespaceName='namespace2',
userId='user-0001',
publicProfile='public2',
followerProfile='follower2',
friendProfile='friend2',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Update profile with user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
publicProfile | string | ~ 1024 chars | Public profile | ||
followerProfile | string | ~ 1024 chars | Profile for followers | ||
friendProfile | string | ~ 1024 chars | Profile for friends |
Result
Type | Description | |
---|---|---|
item | Profile | Updated Profile |
deleteProfileByUserId
deleteProfileByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\DeleteProfileByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteProfileByUserId(
(new DeleteProfileByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
);
Profile item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteProfileByUserIdRequest;
using Gs2.Gs2Friend.Result.DeleteProfileByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteProfileByUserIdResult> asyncResult = null;
yield return client.DeleteProfileByUserId(
new Gs2.Gs2Friend.Request.DeleteProfileByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.deleteProfileByUserId(
new Gs2Friend.DeleteProfileByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_profile_by_user_id(
friend.DeleteProfileByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_profile_by_user_id({
namespaceName='namespace2',
userId='user-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete profile
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | Profile | Deleted Profile |
describeFriends
describeFriends
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeFriendsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeFriends(
(new DescribeFriendsRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
List<FriendUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeFriendsRequest;
using Gs2.Gs2Friend.Result.DescribeFriendsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFriendsResult> asyncResult = null;
yield return client.DescribeFriends(
new Gs2.Gs2Friend.Request.DescribeFriendsRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.describeFriends(
new Gs2Friend.DescribeFriendsRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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_friends(
friend.DescribeFriendsRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_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_friends({
namespaceName='namespace2',
accessToken='$access_token_0001',
withProfile=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of friends
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | 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 acquired |
Result
Type | Description | |
---|---|---|
items | FriendUser[] | List of Friend |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeFriendsByUserId
describeFriendsByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeFriendsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeFriendsByUserId(
(new DescribeFriendsByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
List<FriendUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeFriendsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeFriendsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFriendsByUserIdResult> asyncResult = null;
yield return client.DescribeFriendsByUserId(
new Gs2.Gs2Friend.Request.DescribeFriendsByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.describeFriendsByUserId(
new Gs2Friend.DescribeFriendsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_friends_by_user_id(
friend.DescribeFriendsByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_friends_by_user_id({
namespaceName='namespace2',
userId='user-0001',
withProfile=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of friends by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
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 acquired |
Result
Type | Description | |
---|---|---|
items | FriendUser[] | List of Friend |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeBlackList
describeBlackList
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeBlackList(
(new DescribeBlackListRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withPageToken(null)
.withLimit(null)
);
List<String> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeBlackListRequest;
using Gs2.Gs2Friend.Result.DescribeBlackListResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeBlackListResult> asyncResult = null;
yield return client.DescribeBlackList(
new Gs2.Gs2Friend.Request.DescribeBlackListRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get Blacklist
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | 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 acquired |
Result
Type | Description | |
---|---|---|
items | string[] | Blacklisted user ID list |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeBlackListByUserId
describeBlackListByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeBlackListByUserId(
(new DescribeBlackListByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
);
List<String> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeBlackListByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeBlackListByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeBlackListByUserIdResult> asyncResult = null;
yield return client.DescribeBlackListByUserId(
new Gs2.Gs2Friend.Request.DescribeBlackListByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.describeBlackListByUserId(
new Gs2Friend.DescribeBlackListByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_by_user_id(
friend.DescribeBlackListByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_by_user_id({
namespaceName='namespace2',
userId='user-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get blacklist by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
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 acquired |
Result
Type | Description | |
---|---|---|
items | string[] | Blacklisted user ID list |
nextPageToken | string | Page token to retrieve the rest of the listing |
registerBlackList
registerBlackList
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\RegisterBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->registerBlackList(
(new RegisterBlackListRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.RegisterBlackListRequest;
using Gs2.Gs2Friend.Result.RegisterBlackListResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.RegisterBlackListResult> asyncResult = null;
yield return client.RegisterBlackList(
new Gs2.Gs2Friend.Request.RegisterBlackListRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Add to blacklist
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | BlackList | blacklist |
registerBlackListByUserId
registerBlackListByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\RegisterBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->registerBlackListByUserId(
(new RegisterBlackListByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withTargetUserId("user-0002")
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.RegisterBlackListByUserIdRequest;
using Gs2.Gs2Friend.Result.RegisterBlackListByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.RegisterBlackListByUserIdResult> asyncResult = null;
yield return client.RegisterBlackListByUserId(
new Gs2.Gs2Friend.Request.RegisterBlackListByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.registerBlackListByUserId(
new Gs2Friend.RegisterBlackListByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_by_user_id(
friend.RegisterBlackListByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Add to blacklist by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | BlackList | blacklist |
unregisterBlackList
unregisterBlackList
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UnregisterBlackListRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unregisterBlackList(
(new UnregisterBlackListRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UnregisterBlackListRequest;
using Gs2.Gs2Friend.Result.UnregisterBlackListResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnregisterBlackListResult> asyncResult = null;
yield return client.UnregisterBlackList(
new Gs2.Gs2Friend.Request.UnregisterBlackListRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Remove a user from blacklist
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | BlackList | Blacklist |
unregisterBlackListByUserId
unregisterBlackListByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UnregisterBlackListByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unregisterBlackListByUserId(
(new UnregisterBlackListByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withTargetUserId("user-0002")
);
BlackList item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UnregisterBlackListByUserIdRequest;
using Gs2.Gs2Friend.Result.UnregisterBlackListByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnregisterBlackListByUserIdResult> asyncResult = null;
yield return client.UnregisterBlackListByUserId(
new Gs2.Gs2Friend.Request.UnregisterBlackListByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.unregisterBlackListByUserId(
new Gs2Friend.UnregisterBlackListByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_by_user_id(
friend.UnregisterBlackListByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Remove a user from the blacklist by specifying the user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | BlackList | Blacklist |
describeFollows
describeFollows
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeFollowsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeFollows(
(new DescribeFollowsRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
List<FollowUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeFollowsRequest;
using Gs2.Gs2Friend.Result.DescribeFollowsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFollowsResult> asyncResult = null;
yield return client.DescribeFollows(
new Gs2.Gs2Friend.Request.DescribeFollowsRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.describeFollows(
new Gs2Friend.DescribeFollowsRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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_follows(
friend.DescribeFollowsRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_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_follows({
namespaceName='namespace2',
accessToken='$access_token_0001',
withProfile=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of followings
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | 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 acquired |
Result
Type | Description | |
---|---|---|
items | FollowUser[] | List of Following user |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeFollowsByUserId
describeFollowsByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
WithProfile: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeFollowsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeFollowsByUserId(
(new DescribeFollowsByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withWithProfile(null)
.withPageToken(null)
.withLimit(null)
);
List<FollowUser> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeFollowsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeFollowsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeFollowsByUserIdResult> asyncResult = null;
yield return client.DescribeFollowsByUserId(
new Gs2.Gs2Friend.Request.DescribeFollowsByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.describeFollowsByUserId(
new Gs2Friend.DescribeFollowsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_follows_by_user_id(
friend.DescribeFollowsByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_follows_by_user_id({
namespaceName='namespace2',
userId='user-0001',
withProfile=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of followers by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
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 acquired |
Result
Type | Description | |
---|---|---|
items | FollowUser[] | List of Following user |
nextPageToken | string | Page token to retrieve the rest of the listing |
getFollow
getFollow
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetFollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFollow(
(new GetFollowRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetFollowRequest;
using Gs2.Gs2Friend.Result.GetFollowResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFollowResult> asyncResult = null;
yield return client.GetFollow(
new Gs2.Gs2Friend.Request.GetFollowRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.getFollow(
new Gs2Friend.GetFollowRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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_follow(
friend.GetFollowRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_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_follow({
namespaceName='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get a Following user
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together |
Result
Type | Description | |
---|---|---|
item | FollowUser | Following user |
getFollowByUserId
getFollowByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetFollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFollowByUserId(
(new GetFollowByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withTargetUserId(null)
->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.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("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
.withWithProfile(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetFollowByUserIdRequest;
using Gs2.Gs2Friend.Result.GetFollowByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFollowByUserIdResult> asyncResult = null;
yield return client.GetFollowByUserId(
new Gs2.Gs2Friend.Request.GetFollowByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithTargetUserId(null)
.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.getFollowByUserId(
new Gs2Friend.GetFollowByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
.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_follow_by_user_id(
friend.GetFollowByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
.with_target_user_id(None)
.with_with_profile(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_follow_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId=nil,
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get a Following user by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together |
Result
Type | Description | |
---|---|---|
item | FollowUser | Following user |
follow
follow
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\FollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->follow(
(new FollowRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.FollowRequest;
using Gs2.Gs2Friend.Result.FollowResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.FollowResult> asyncResult = null;
yield return client.Follow(
new Gs2.Gs2Friend.Request.FollowRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Follow to other player
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to follow |
Result
Type | Description | |
---|---|---|
item | FollowUser | Followed user |
followByUserId
followByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\FollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->followByUserId(
(new FollowByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.FollowByUserIdRequest;
using Gs2.Gs2Friend.Result.FollowByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.FollowByUserIdResult> asyncResult = null;
yield return client.FollowByUserId(
new Gs2.Gs2Friend.Request.FollowByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(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(self.hash2)
.with_user_id('user-0001')
.with_target_user_id(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.follow_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Follow to other player by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to follow |
Result
Type | Description | |
---|---|---|
item | FollowUser | Followed user |
unfollow
unfollow
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UnfollowRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unfollow(
(new UnfollowRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UnfollowRequest;
using Gs2.Gs2Friend.Result.UnfollowResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnfollowResult> asyncResult = null;
yield return client.Unfollow(
new Gs2.Gs2Friend.Request.UnfollowRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Unfollow to other player
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FollowUser | Unfollowed user |
unfollowByUserId
unfollowByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\UnfollowByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->unfollowByUserId(
(new UnfollowByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
);
FollowUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.UnfollowByUserIdRequest;
using Gs2.Gs2Friend.Result.UnfollowByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.UnfollowByUserIdResult> asyncResult = null;
yield return client.UnfollowByUserId(
new Gs2.Gs2Friend.Request.UnfollowByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(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(self.hash2)
.with_user_id('user-0001')
.with_target_user_id(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.unfollow_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Unfollow to other player by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FollowUser | Unfollowed user |
getFriend
getFriend
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFriend(
(new GetFriendRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetFriendRequest;
using Gs2.Gs2Friend.Result.GetFriendResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFriendResult> asyncResult = null;
yield return client.GetFriend(
new Gs2.Gs2Friend.Request.GetFriendRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.getFriend(
new Gs2Friend.GetFriendRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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_friend(
friend.GetFriendRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_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_friend({
namespaceName='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get a Friend
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together |
Result
Type | Description | |
---|---|---|
item | FriendUser | Friend |
getFriendByUserId
getFriendByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
WithProfile: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getFriendByUserId(
(new GetFriendByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withTargetUserId("user-0002")
.withWithProfile(null)
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetFriendByUserIdRequest;
using Gs2.Gs2Friend.Result.GetFriendByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetFriendByUserIdResult> asyncResult = null;
yield return client.GetFriendByUserId(
new Gs2.Gs2Friend.Request.GetFriendByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.getFriendByUserId(
new Gs2Friend.GetFriendByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_friend_by_user_id(
friend.GetFriendByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_friend_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId='user-0002',
withProfile=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get a Friend by user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together |
Result
Type | Description | |
---|---|---|
item | FriendUser | Friend |
deleteFriend
deleteFriend
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\DeleteFriendRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteFriend(
(new DeleteFriendRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteFriendRequest;
using Gs2.Gs2Friend.Result.DeleteFriendResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteFriendResult> asyncResult = null;
yield return client.DeleteFriend(
new Gs2.Gs2Friend.Request.DeleteFriendRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete Friend
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FriendUser | Deleted Friend |
deleteFriendByUserId
deleteFriendByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\DeleteFriendByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteFriendByUserId(
(new DeleteFriendByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withTargetUserId("user-0002")
);
FriendUser item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteFriendByUserIdRequest;
using Gs2.Gs2Friend.Result.DeleteFriendByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteFriendByUserIdResult> asyncResult = null;
yield return client.DeleteFriendByUserId(
new Gs2.Gs2Friend.Request.DeleteFriendByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.deleteFriendByUserId(
new Gs2Friend.DeleteFriendByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_by_user_id(
friend.DeleteFriendByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FriendUser | Deleted Friend |
describeSendRequests
describeSendRequests
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeSendRequestsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeSendRequests(
(new DescribeSendRequestsRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeSendRequestsRequest;
using Gs2.Gs2Friend.Result.DescribeSendRequestsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeSendRequestsResult> asyncResult = null;
yield return client.DescribeSendRequests(
new Gs2.Gs2Friend.Request.DescribeSendRequestsRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.describeSendRequests(
new Gs2Friend.DescribeSendRequestsRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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_send_requests(
friend.DescribeSendRequestsRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_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_send_requests({
namespaceName='namespace2',
accessToken='$access_token_0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of friend requests you have sent
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | 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 acquired |
Result
Type | Description | |
---|---|---|
items | FriendRequest[] | List of Friend Request |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeSendRequestsByUserId
describeSendRequestsByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeSendRequestsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeSendRequestsByUserId(
(new DescribeSendRequestsByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeSendRequestsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeSendRequestsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeSendRequestsByUserIdResult> asyncResult = null;
yield return client.DescribeSendRequestsByUserId(
new Gs2.Gs2Friend.Request.DescribeSendRequestsByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.describeSendRequestsByUserId(
new Gs2Friend.DescribeSendRequestsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_send_requests_by_user_id(
friend.DescribeSendRequestsByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_send_requests_by_user_id({
namespaceName='namespace2',
userId='user-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Obtain list of friend requests sent by specifying a user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
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 acquired |
Result
Type | Description | |
---|---|---|
items | FriendRequest[] | List of Friend Request |
nextPageToken | string | Page token to retrieve the rest of the listing |
getSendRequest
getSendRequest
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetSendRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getSendRequest(
(new GetSendRequestRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetSendRequestRequest;
using Gs2.Gs2Friend.Result.GetSendRequestResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetSendRequestResult> asyncResult = null;
yield return client.GetSendRequest(
new Gs2.Gs2Friend.Request.GetSendRequestRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.getSendRequest(
new Gs2Friend.GetSendRequestRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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.get_send_request(
friend.GetSendRequestRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_0001)
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_send_request({
namespaceName='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Retrieve friend requests sent
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FriendRequest | Friend Request |
getSendRequestByUserId
getSendRequestByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetSendRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getSendRequestByUserId(
(new GetSendRequestByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetSendRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.GetSendRequestByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetSendRequestByUserIdResult> asyncResult = null;
yield return client.GetSendRequestByUserId(
new Gs2.Gs2Friend.Request.GetSendRequestByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(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(self.hash2)
.with_user_id('user-0001')
.with_target_user_id(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.get_send_request_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Retrieves friend requests sent by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FriendRequest | Friend Request |
sendRequest
sendRequest
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\SendRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->sendRequest(
(new SendRequestRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.SendRequestRequest;
using Gs2.Gs2Friend.Result.SendRequestResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.SendRequestResult> asyncResult = null;
yield return client.SendRequest(
new Gs2.Gs2Friend.Request.SendRequestRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.sendRequest(
new Gs2Friend.SendRequestRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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.send_request(
friend.SendRequestRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_0001)
.with_target_user_id('user-0002')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.send_request({
namespaceName='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Send a friend request
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to be friend |
Result
Type | Description | |
---|---|---|
item | FriendRequest | Friend request sent |
sendRequestByUserId
sendRequestByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\SendRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->sendRequestByUserId(
(new SendRequestByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.SendRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.SendRequestByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.SendRequestByUserIdResult> asyncResult = null;
yield return client.SendRequestByUserId(
new Gs2.Gs2Friend.Request.SendRequestByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(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(self.hash2)
.with_user_id('user-0001')
.with_target_user_id(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.send_request_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Send a friend request specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to be friend |
Result
Type | Description | |
---|---|---|
item | FriendRequest | Friend request sent |
deleteRequest
deleteRequest
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
TargetUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\DeleteRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteRequest(
(new DeleteRequestRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withTargetUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteRequestRequest;
using Gs2.Gs2Friend.Result.DeleteRequestResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteRequestResult> asyncResult = null;
yield return client.DeleteRequest(
new Gs2.Gs2Friend.Request.DeleteRequestRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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("namespace2")
.withAccessToken("$access_token_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(self.hash2)
.with_access_token(self.access_token_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='namespace2',
accessToken='$access_token_0001',
targetUserId='user-0002',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete friend request
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FriendRequest | Deleted Friend Requests |
deleteRequestByUserId
deleteRequestByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
TargetUserId: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\DeleteRequestByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteRequestByUserId(
(new DeleteRequestByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
->withTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(null)
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DeleteRequestByUserIdRequest;
using Gs2.Gs2Friend.Result.DeleteRequestByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DeleteRequestByUserIdResult> asyncResult = null;
yield return client.DeleteRequestByUserId(
new Gs2.Gs2Friend.Request.DeleteRequestByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001")
.WithTargetUserId(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("namespace2")
.withUserId("user-0001")
.withTargetUserId(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(self.hash2)
.with_user_id('user-0001')
.with_target_user_id(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('friend')
api_result = client.delete_request_by_user_id({
namespaceName='namespace2',
userId='user-0001',
targetUserId=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete friend request by specifying user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | FriendRequest | Deleted Friend Requests |
describeReceiveRequests
describeReceiveRequests
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeReceiveRequestsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeReceiveRequests(
(new DescribeReceiveRequestsRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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("namespace2")
.withAccessToken("$access_token_0001")
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeReceiveRequestsRequest;
using Gs2.Gs2Friend.Result.DescribeReceiveRequestsResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeReceiveRequestsResult> asyncResult = null;
yield return client.DescribeReceiveRequests(
new Gs2.Gs2Friend.Request.DescribeReceiveRequestsRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.describeReceiveRequests(
new Gs2Friend.DescribeReceiveRequestsRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_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_receive_requests(
friend.DescribeReceiveRequestsRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_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_receive_requests({
namespaceName='namespace2',
accessToken='$access_token_0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of received friend requests
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
accessToken | 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 acquired |
Result
Type | Description | |
---|---|---|
items | FriendRequest[] | List of Friend request |
nextPageToken | string | Page token to retrieve the rest of the listing |
describeReceiveRequestsByUserId
describeReceiveRequestsByUserId
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("namespace2"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
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\DescribeReceiveRequestsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeReceiveRequestsByUserId(
(new DescribeReceiveRequestsByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-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.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("namespace2")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
);
List<FriendRequest> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.DescribeReceiveRequestsByUserIdRequest;
using Gs2.Gs2Friend.Result.DescribeReceiveRequestsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.DescribeReceiveRequestsByUserIdResult> asyncResult = null;
yield return client.DescribeReceiveRequestsByUserId(
new Gs2.Gs2Friend.Request.DescribeReceiveRequestsByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-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.describeReceiveRequestsByUserId(
new Gs2Friend.DescribeReceiveRequestsByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-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_receive_requests_by_user_id(
friend.DescribeReceiveRequestsByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-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_receive_requests_by_user_id({
namespaceName='namespace2',
userId='user-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Obtain list of friend requests received by specifying a user ID
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
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 acquired |
Result
Type | Description | |
---|---|---|
items | FriendRequest[] | List of Friend request |
nextPageToken | string | Page token to retrieve the rest of the listing |
getReceiveRequest
getReceiveRequest
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("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
FromUserId: pointy.String("user-0002"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
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\GetReceiveRequestRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getReceiveRequest(
(new GetReceiveRequestRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
->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.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("namespace2")
.withAccessToken("$access_token_0001")
.withFromUserId("user-0002")
);
FriendRequest item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Friend.Gs2FriendRestClient;
using Gs2.Gs2Friend.Request.GetReceiveRequestRequest;
using Gs2.Gs2Friend.Result.GetReceiveRequestResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2FriendRestClient(session);
AsyncResult<Gs2.Gs2Friend.Result.GetReceiveRequestResult> asyncResult = null;
yield return client.GetReceiveRequest(
new Gs2.Gs2Friend.Request.GetReceiveRequestRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_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.getReceiveRequest(
new Gs2Friend.