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
| Type | Require | Default | Limitation | Description |
---|
userId | string | ✓ | | ~ 128 chars | User Id |
targetUserIds | List<string> | | | ~ 10000 items | Blacklist user ID list |
EzFollowUser
| 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
| 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
| Type | Require | Default | Limitation | Description |
---|
userId | string | ✓ | | ~ 128 chars | Sender |
targetUserId | string | ✓ | | ~ 128 chars | Target |
EzPublicProfile
| 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 | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
Result
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(
AccessToken
)->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(
AccessToken
)->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 | ✓ | | ~ 32 chars | Namespace name |
userId | string | ✓ | | ~ 128 chars | User Id |
Result
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 | ✓ | | ~ 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
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(
AccessToken
)->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 (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
describeFollowUsers
Get list of followed players
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 |
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
);
var items = await domain.FollowsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
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(
AccessToken
);
const auto It = Domain->Follows( // withProfile
);
for (auto Item : *It)
{
}
follow
Follow 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
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: true
);
var result = await domain.FollowAsync(
);
var item = await result.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: true
);
var future = domain.FollowFuture(
);
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(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
true // withProfile
);
const auto Future = Domain->Follow(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
getFollowUser
Get followed player
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 |
targetUserId | string | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
nullptr // withProfile
);
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
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
// 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
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var future = domain.Model();
yield return future;
var item = future.Result;
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
nullptr // withProfile
);
// 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 | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
targetUserId | string | ✓ | | ~ 128 chars | User Id |
Result
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
var result = await domain.UnfollowAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).FollowUser(
targetUserId: "user-0002",
withProfile: null
);
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(
AccessToken
)->FollowUser(
"user-0002", // targetUserId
nullptr // withProfile
);
const auto Future = Domain->Unfollow(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
deleteFriend
Remove 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
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var result = await domain.DeleteFriendAsync(
);
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var future = domain.DeleteFriendFuture(
);
yield return future;
if (future.Error != null)
{
onError.Invoke(future.Error, null);
yield break;
}
const auto Domain = Gs2->Friend->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Friend(
nullptr // withProfile
)->FriendUser(
"user-0002" // targetUserId
);
const auto Future = Domain->DeleteFriend(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeFriends
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 |
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(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.Friends(
);
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(
AccessToken
);
const auto It = Domain->Friends( // withProfile
);
for (auto Item : *It)
{
}
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(
);
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(
AccessToken
);
// 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 | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
targetUserId | string | ✓ | | ~ 128 chars | User Id |
withProfile | bool | ✓ | false | | Get a profile together |
Result
Implementation Example
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).FriendUser(
targetUserId: "user-0002"
);
var item = await domain.ModelAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Friend(
withProfile: null
).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(
AccessToken
)->Friend(
nullptr // 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: null
).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: null
).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(
AccessToken
)->Friend(
nullptr // 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 | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
targetUserId | string | ✓ | | ~ 128 chars | User Id |
Result
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(
AccessToken
)->SendFriendRequest(
"user-0002" // targetUserId
);
const auto Future = Domain->DeleteRequest(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeSendRequests
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 |
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(
AccessToken
);
const auto It = Domain->SendRequests(
);
for (auto Item : *It)
{
}
getSendRequest
Get friend request you have 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
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(
AccessToken
)->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(
AccessToken
)->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
Get a friend requests you have 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 of the person want to be friend |
Result
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(
AccessToken
);
const auto Future = Domain->SendRequest(
"user-0002"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
accept
Approve Friend Request
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
fromUserId | string | ✓ | | ~ 128 chars | User Id |
Result
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(
AccessToken
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Accept(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
describeReceiveRequests
Get list of received friend requests
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 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(
AccessToken
);
const auto It = Domain->ReceiveRequests(
);
for (auto Item : *It)
{
}
getReceiveRequest
Get received friend request
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
fromUserId | string | ✓ | | ~ 128 chars | User Id |
Result
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(
AccessToken
)->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(
AccessToken
)->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 | ✓ | | ~ 32 chars | Namespace name |
accessToken | string | ✓ | | ~ 128 chars | User Id |
fromUserId | string | ✓ | | ~ 128 chars | User Id |
Result
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(
AccessToken
)->ReceiveFriendRequest(
nullptr, // targetUserId
"user-0002" // fromUserId
);
const auto Future = Domain->Reject(
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
getBlackList
Get Blacklist
Request
| Type | Require | Default | Limitation | Description |
---|
namespaceName | string | ✓ | | ~ 32 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.BlackListsAsync(
).ToListAsync();
var domain = gs2.Friend.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
);
var it = domain.BlackLists(
);
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(
AccessToken
);
const auto It = Domain->BlackLists(
);
for (auto Item : *It)
{
}
registerBlackList
Add user 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
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(
AccessToken
)->BlackList(
);
const auto Future = Domain->RegisterBlackList(
"user-0002"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
unregisterBlackList
Remove 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
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(
AccessToken
)->BlackList(
);
const auto Future = Domain->UnregisterBlackList(
"user-0002"
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}
// obtain changed values / result values
const auto Future2 = Future->GetTask().Result()->Model();
Future2->StartSynchronousTask();
if (!TestFalse(WHAT, Future2->GetTask().IsError())) return false;
const auto Result = Future2->GetTask().Result();
Event Handler
OnFollowNotification
Notification to be used when you are followed
Name | Type | Description |
---|
namespaceName | string | Namespace name |
fromUserId | string | User Id |
Implementation Example
gs2.Friend.OnFollowNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnFollowNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnFollowNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto FromUserId = Notification->FromUserIdValue;
});
OnAcceptRequestNotification
Notification used when a friend request is approved
Name | Type | Description |
---|
namespaceName | string | Namespace name |
targetUserId | string | User Id |
Implementation Example
gs2.Friend.OnAcceptRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var targetUserId = notification.TargetUserId;
};
gs2.Friend.OnAcceptRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var targetUserId = notification.TargetUserId;
};
Gs2->Friend->OnAcceptRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto TargetUserId = Notification->TargetUserIdValue;
});
OnReceiveRequestNotification
Notification used when a friend request is received
Name | Type | Description |
---|
namespaceName | string | Namespace name |
fromUserId | string | User Id |
Implementation Example
gs2.Friend.OnReceiveRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
gs2.Friend.OnReceiveRequestNotification += notification =>
{
var namespaceName = notification.NamespaceName;
var fromUserId = notification.FromUserId;
};
Gs2->Friend->OnReceiveRequestNotification().AddLambda([](const auto Notification)
{
const auto NamespaceName = Notification->NamespaceNameValue;
const auto FromUserId = Notification->FromUserIdValue;
});