API Reference of GS2-Friend SDK for Game Engine
Model
EzProfile
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 | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
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 |
EzBlackList
Blacklist
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserIds | List<string> | ~ 10000 items | Blacklist user ID list |
EzFollowUser
Users you are following
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | |
publicProfile | string | ~ 1024 chars | Public profile | ||
followerProfile | string | ~ 1024 chars | Profile for followers |
EzFriendUser
Friend’s users
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | |
publicProfile | string | ~ 1024 chars | Public profile | ||
friendProfile | string | ~ 1024 chars | Profile for friends |
EzFriendRequest
friend request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | Sender | |
targetUserId | string | ✓ | ~ 128 chars | Target |
EzPublicProfile
Profile available to everyone
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
userId | string | ✓ | ~ 128 chars | User Id | |
publicProfile | string | ~ 1024 chars | Public profile |
Methods
getProfile
Get own profile
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzProfile | Profile |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Profile(
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Profile(
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FProfile> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
getPublicProfile
Get someone else’s public profile
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
userId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzPublicProfile | Public Profile |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->User(
"user-0001" // userId
)->PublicProfile(
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).User(
userId: "user-0001"
).PublicProfile(
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->User(
"user-0001" // userId
)->PublicProfile(
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FPublicProfile> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
updateProfile
Update own profile
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 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 | EzProfile | Updated Profile |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var result = await domain.UpdateProfileAsync(
publicProfile: "public",
followerProfile: "follower",
friendProfile: "friend"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Profile(
);
var future = domain.UpdateProfileFuture(
publicProfile: "public",
followerProfile: "follower",
friendProfile: "friend"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Profile(
);
const auto Future = Domain->UpdateProfile(
"public", // publicProfile
"follower", // followerProfile
"friend" // friendProfile
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();
describeFollowUsers
Get list of followed players
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together | |
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data |
Result
Type | Description | |
---|---|---|
items | List<EzFollowUser> | List of Following user |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
);
var items = await domain.FollowsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
);
var it = domain.Follows(
);
List<EzFollowUser> items = new List<EzFollowUser>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Follow(
true // withProfile
);
const auto It = Domain->Follows(
);
TArray<Gs2::UE5::Friend::Model::FEzFollowUserPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
follow
Follow other player
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User ID of the person want to follow | |
withProfile | bool | ✓ | false | Get a profile together |
Result
Type | Description | |
---|---|---|
item | EzFollowUser | Followed user |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
);
var result = await domain.FollowAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
);
var future = domain.FollowFuture(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Follow(
true // withProfile
);
const auto Future = Domain->Follow(
"user-0002" // targetUserId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();
getFollowUser
Get followed player
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzFollowUser | Following user |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
).FollowUser(
targetUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
).FollowUser(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Follow(
true // withProfile
)->FollowUser(
"user-0002" // targetUserId
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
).FollowUser(
targetUserId: "user-0002"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
).FollowUser(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Follow(
true // withProfile
)->FollowUser(
"user-0002" // targetUserId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FFollowUser> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
unfollow
Unfollow other player
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 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 | EzFollowUser | Unfollowed user |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
).FollowUser(
targetUserId: "user-0002"
);
var result = await domain.UnfollowAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Follow(
withProfile: true
).FollowUser(
targetUserId: "user-0002"
);
var future = domain.UnfollowFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Follow(
true // withProfile
)->FollowUser(
"user-0002" // targetUserId
);
const auto Future = Domain->Unfollow(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
deleteFriend
Remove Friend
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 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 | EzFriendUser | Deleted Friend |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: true
);
var result = await domain.DeleteFriendAsync(
targetUserId: "user-0002"
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: true
);
var future = domain.DeleteFriendFuture(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Friend(
true // withProfile
);
const auto Future = Domain->DeleteFriend(
"user-0002" // targetUserId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
describeFriends
Get list of friends
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
withProfile | bool | ✓ | false | Get a profile together | |
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data |
Result
Type | Description | |
---|---|---|
items | List<EzFriendUser> | List of Friend |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.FriendsAsync(
withProfile: true
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Friends(
withProfile: true
);
List<EzFriendUser> items = new List<EzFriendUser>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->Friends(
true // withProfile
);
TArray<Gs2::UE5::Friend::Model::FEzFriendUserPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
// Start event handling
var callbackId = domain.SubscribeFriends(
() => {
// Called when an element of the list changes.
}
);
// Stop event handling
domain.UnsubscribeFriends(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Friends(
withProfile: true
);
List<EzFriendUser> items = new List<EzFriendUser>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
// Start event handling
const auto CallbackId = Domain->SubscribeFriends(
[]() {
// Called when an element of the list changes.
}
);
// Stop event handling
Domain->UnsubscribeFriends(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
getFriend
Get a Friend
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 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 | EzFriendUser | Friend |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: true
).FriendUser(
targetUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: true
).FriendUser(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Friend(
true // withProfile
)->FriendUser(
"user-0002" // targetUserId
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: true
).FriendUser(
targetUserId: "user-0002"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: true
).FriendUser(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->Friend(
true // withProfile
)->FriendUser(
"user-0002" // targetUserId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FFriendUser> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
deleteRequest
Delete friend request
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzFriendRequest | Deleted Friend Requests |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var result = await domain.DeleteRequestAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var future = domain.DeleteRequestFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->SendFriendRequest(
"user-0002" // targetUserId
);
const auto Future = Domain->DeleteRequest(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
describeSendRequests
Get list of friend requests you have sent
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
items | List<EzFriendRequest> | List of Friend Request |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.SendRequestsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.SendRequests(
);
List<EzFriendRequest> items = new List<EzFriendRequest>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->SendRequests(
);
TArray<Gs2::UE5::Friend::Model::FEzFriendRequestPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
getSendRequest
Get friend request you have sent
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzFriendRequest | Friend Request |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->SendFriendRequest(
"user-0002" // targetUserId
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).SendFriendRequest(
targetUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->SendFriendRequest(
"user-0002" // targetUserId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FSendFriendRequest> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
sendRequest
Send friend request
If the number of “current friends” reaches 1000, you cannot send a new request. If there is one or more “unaccepted friend requests”, the oldest “unaccepted friend request” will be withdrawn and a new request will be sent.
And, if the recipient of the friend request has 1000 “unaccepted friend requests”, the oldest “unaccepted friend request” will be withdrawn and a new request will be accepted.
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 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 | EzFriendRequest | Friend request sent |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var result = await domain.SendRequestAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var future = domain.SendRequestFuture(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto Future = Domain->SendRequest(
"user-0002" // targetUserId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();
accept
Approve Friend Request
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
fromUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzFriendRequest | Accepted Friend Request |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var result = await domain.AcceptAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.AcceptFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Accept(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
describeReceiveRequests
Get list of received friend requests
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
items | List<EzFriendRequest> | List of Friend request |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.ReceiveRequestsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.ReceiveRequests(
);
List<EzFriendRequest> items = new List<EzFriendRequest>();
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->ReceiveRequests(
);
TArray<Gs2::UE5::Friend::Model::FEzFriendRequestPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
getReceiveRequest
Get received friend request
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
fromUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzFriendRequest | Friend request |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Model();
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
Value change event handling
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
// Start event handling
var callbackId = domain.Subscribe(
value => {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
domain.Unsubscribe(callbackId);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
// Start event handling
const auto CallbackId = Domain->Subscribe(
[](TSharedPtr<Gs2::Friend::Model::FReceiveFriendRequest> value) {
// Called when the value changes
// The "value" is passed the value after the change.
}
);
// Stop event handling
Domain->Unsubscribe(CallbackId);
Warning
This event is called when the value in the local cache that the SDK has is changed.
The local cache will only be changed by executing the SDK’s API, or by executing a stamp sheet via GS2-Distributor with GS2-Gateway notification enabled, or by executing a GS2-JobQueue with GS2-Gateway notification enabled. GS2-Gateway notification enabled.
Therefore, callbacks will not be invoked if the value is changed in any other way.
reject
Deny friend request
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
fromUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzFriendRequest | Rejected friend request |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var result = await domain.RejectAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).ReceiveFriendRequest(
targetUserId: null,
fromUserId: "user-0002"
);
var future = domain.RejectFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Reject(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
const auto Result = Future->GetTask().Result();
getBlackList
Get Blacklist
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
items | List<string> | Blacklisted user ID list |
nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var items = await domain.BlackListUsersAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.BlackListUsers(
);
while (it.HasNext())
{
yield return it.Next();
if (it.Error != null)
{
onError.Invoke(it.Error, null);
break;
}
if (it.Current != null)
{
items.Add(it.Current);
}
else
{
break;
}
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
);
const auto It = Domain->BlackListUsers(
);
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}
registerBlackList
Add user to blacklist
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzBlackList | blacklist |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var result = await domain.RegisterBlackListAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var future = domain.RegisterBlackListFuture(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->BlackList(
);
const auto Future = Domain->RegisterBlackList(
"user-0002" // targetUserId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();
unregisterBlackList
Remove user from blacklist
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
accessToken | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | User Id |
Result
Type | Description | |
---|---|---|
item | EzBlackList | Blacklist |
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var result = await domain.UnregisterBlackListAsync(
targetUserId: "user-0002"
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).BlackList(
);
var future = domain.UnregisterBlackListFuture(
targetUserId: "user-0002"
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
var future2 = future.Result.Model();
yield return future2;
if (future2.Error != null)
{
onError.Invoke(future2.Error, null);
yield break;
}
var result = future2.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
GameSession
)->BlackList(
);
const auto Future = Domain->UnregisterBlackList(
"user-0002" // targetUserId
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (Future2->GetTask().IsError())
{
return Future2->GetTask().Error();
}
const auto Result = Future2->GetTask().Result();
Event Handler
OnFollowNotification
Notification to be used when you are followed
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
fromUserId | string | User Id |
Implementation Example
gs2.Friend.OnFollowNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnFollowNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnFollowNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto FromUserId = Notification->FromUserIdValue;
});
OnAcceptRequestNotification
Notification used when a friend request is approved
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
targetUserId | string | User Id |
Implementation Example
gs2.Friend.OnAcceptRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var targetUserId = notification.TargetUserId;
};
gs2.Friend.OnAcceptRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var targetUserId = notification.TargetUserId;
};
Gs2->Friend->OnAcceptRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto TargetUserId = Notification->TargetUserIdValue;
});
OnRejectRequestNotification
Notification used when a friend request is rejected
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
targetUserId | string | User Id |
Implementation Example
gs2.Friend.OnRejectRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var targetUserId = notification.TargetUserId;
};
gs2.Friend.OnRejectRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var targetUserId = notification.TargetUserId;
};
Gs2->Friend->OnRejectRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto TargetUserId = Notification->TargetUserIdValue;
});
OnDeleteFriendNotification
Notification used when a friend is deleted
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
fromUserId | string | User Id |
Implementation Example
gs2.Friend.OnDeleteFriendNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnDeleteFriendNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnDeleteFriendNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto FromUserId = Notification->FromUserIdValue;
});
OnReceiveRequestNotification
Notification used when a friend request is received
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
fromUserId | string | User Id |
Implementation Example
gs2.Friend.OnReceiveRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnReceiveRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnReceiveRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto FromUserId = Notification->FromUserIdValue;
});
OnCancelRequestNotification
Notification used when a friend request is canceled
Name | Type | Description |
---|---|---|
namespaceName | string | Namespace name |
userId | string | User Id |
fromUserId | string | User Id |
Implementation Example
gs2.Friend.OnCancelRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnCancelRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var userId = notification.UserId;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnCancelRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto UserId = Notification->UserIdValue;
const auto FromUserId = Notification->FromUserIdValue;
});