차단 내역 조회
계정 차단 사유를 조회하는 API입니다.
API 정보
- URL:
https://service-account.playnanoo.com/api/v20221201/reason - Method:
PUT - 인증 필요: 예
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| platform | string | 필수 | 플랫폼 (예: "aos", "ios") |
| device_id | string | 필수 | 기기 고유 ID |
| device_model | string | 필수 | 기기 모델명 |
| device_os | string | 필수 | 기기 OS |
| device_language | string | 필수 | 기기 언어 (예: "KO", "EN") |
응답 데이터
Items 배열
각 차단 항목은 다음 정보를 포함합니다:
userId: 사용자 IDReason: 차단 사유Permanent: 영구 차단 여부ExpireDate: 차단 만료일 (영구 차단이 아닌 경우)
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 UnityEngine.Networking;
public class Reason
{
static string path = "https://service-api.playnanoo.com/block/v20221201/reason";
[Serializable]
public class Req : DeviceInfo
{
public string block_key;
public IEnumerator Send(string block_key, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(block_key)) this.block_key = block_key;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: false,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public SerializeItems[] Items;
}
[Serializable]
public class SerializeItems
{
public string userId;
public string Reason;
public string Permanent;
public string ExpireDate;
public string TimeUntilExpire;
public string[] Services;
}
}
사용 예제
public void GetBlockReason()
{
Reason.Req req = new Reason.Req();
StartCoroutine(req.Send(
block_key: "차단시_받은_block_key",
onSuccess: res =>
{
if (res.Items != null && res.Items.Length > 0)
{
foreach (var item in res.Items)
{
Debug.Log($"사용자 ID: {item.userId}");
Debug.Log($"차단 사유: {item.Reason}");
Debug.Log($"영구 차단: {item.Permanent}");
Debug.Log($"남은 시간: {item.TimeUntilExpire}");
if (item.Permanent != "Y")
{
Debug.Log($"차단 만료일: {item.ExpireDate}");
}
}
}
else
{
Debug.Log("차단 내역이 없습니다.");
}
},
onError: (error) =>
{
Debug.LogError($"차단 사유 조회 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
차단 종류
- 임시 차단:
Permanent가 "N"이고ExpireDate가 설정된 경우. 지정된 날짜까지만 차단됩니다. - 영구 차단:
Permanent가 "Y"인 경우. 해제되기 전까지 계속 차단됩니다.
차단된 계정
이 API는 차단된 계정의 차단 사유를 확인할 때 사용합니다. 로그인 시도 시 차단 에러가 발생하면 이 API를 호출하여 사용자에게 상세한 차단 정보를 표시할 수 있습니다.