본문으로 건너뛰기

친구 요청 목록 조회

대기 중인 친구 요청 목록을 조회합니다.

URL 확인

이 API는 service-api.playnanoo.com 도메인을 사용합니다.

API 정보

  • URL: https://service-api.playnanoo.com/friend/v20231201/searchPending
  • Method: PUT
  • 인증 필요: 예
DeviceInfo 상속

이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.

요청 파라미터

파라미터타입필수설명
table_codestring필수친구 테이블 코드

응답 데이터

Res 클래스

필드타입설명
ItemsList<FriendItem>대기 중인 친구 요청 목록

FriendItem 클래스

필드타입설명
RelationshipCodestring관계 코드
UserIdstring사용자 ID
Nicknamestring닉네임
Timezonestring타임존
AccessSecondsdouble마지막 접속 시간 (초 단위)

Unity C# 구현

BaseResponse 클래스

모든 API 응답의 기본 클래스입니다.

public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}

필드 설명:

  • ErrorCode: 에러 코드
  • Message: 에러 메시지
  • WithdrawalKey: 탈퇴 유예 상태인 경우 복구에 필요한 키 (탈퇴 유예 중인 계정만 제공)
  • BlockKey: 차단된 계정인 경우 제공되는 키 (차단된 계정만 제공)

대기 중인 친구 요청 조회 클래스

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;
}
}

사용 예제

using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
void GetPendingFriendRequests()
{
FriendReadyAll.Req req = new FriendReadyAll.Req();

StartCoroutine(req.Send(
tableCode: "friend_table",
onSuccess: res =>
{
Debug.Log($"대기 중인 친구 요청: {res.Items.Count}건");

foreach (var request in res.Items)
{
Debug.Log($"요청자: {request.Nickname}");
Debug.Log($" 관계 코드: {request.RelationshipCode}");
}
},
onError: (error) =>
{
Debug.LogError($"대기 중인 친구 요청 조회 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
}
수락/거절

대기 중인 친구 요청은 accept API로 수락하거나 delete API로 거절할 수 있습니다.