Get Pending Friend Requests
Retrieves the list of pending friend requests.
URL Confirmation
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/friend/v20231201/searchPending - Method:
PUT - Authentication Required: Yes
DeviceInfo Inheritance
The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| table_code | string | Required | Friend table code |
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| Items | List<FriendItem> | Pending friend request list |
FriendItem Class
| Field | Type | Description |
|---|---|---|
| RelationshipCode | string | Relationship code |
| UserId | string | User ID |
| Nickname | string | Nickname |
| Timezone | string | Timezone |
| AccessSeconds | double | Last access time (in seconds) |
Unity C# Implementation
BaseResponse Class
Base class for all API responses.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
Field descriptions:
ErrorCode: Error codeMessage: Error messageWithdrawalKey: Key required for recovery if account is in withdrawal grace period (provided only for accounts in withdrawal grace period)BlockKey: Key provided if account is blocked (provided only for blocked accounts)
Pending Friend Request Retrieval Class
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Networking;
public class FriendReadyAll
{
static string path = "https://service-api.playnanoo.com/friend/v20231201/searchPending";
[Serializable]
public class Req : DeviceInfo
{
public string table_code;
public IEnumerator Send(string tableCode, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(tableCode)) this.table_code = tableCode;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public List<FriendItem> Items;
}
[Serializable]
public class FriendItem
{
public string RelationshipCode;
public string UserId;
public string Nickname;
public string Timezone;
public double AccessSeconds;
}
}
Usage Example
using PlayNANOO;
public class PlayNANOOExample : MonoBehaviour
{
void GetPendingFriendRequests()
{
FriendReadyAll.Req req = new FriendReadyAll.Req();
StartCoroutine(req.Send(
tableCode: "friend_table",
onSuccess: res =>
{
Debug.Log($"Pending friend requests: {res.Items.Count}");
foreach (var request in res.Items)
{
Debug.Log($"Requester: {request.Nickname}");
Debug.Log($" Relationship Code: {request.RelationshipCode}");
}
},
onError: (error) =>
{
Debug.LogError($"Failed to retrieve pending friend requests: [{error.ErrorCode}] [{error.Message}]");
}
));
}
}
Accept/Reject
Pending friend requests can be accepted using the accept API or rejected using the delete API.