본문으로 건너뛰기

플레이어 삭제

리더보드에서 특정 플레이어의 기록을 삭제하는 API입니다.

URL 확인

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

API 정보

  • URL: https://service-api.playnanoo.com/leaderboard/v20240301/delete
  • Method: PUT
  • 인증 필요: 예
DeviceInfo 상속

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

요청 파라미터

파라미터타입필수설명
uidstring필수테이블 코드
record_idstring필수삭제할 기록 ID (플레이어 식별자)

응답 데이터

Res 클래스

필드타입설명
Statusstring처리 상태

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 PlayerDelete
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/delete";

[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_id;

public IEnumerator Send(string table_code, string recordId, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
if (!string.IsNullOrEmpty(recordId)) this.record_id = recordId;

yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}

[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}

사용 예제

public void DeletePlayerRecord()
{
PlayerDelete.Req req = new PlayerDelete.Req();

StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordId: "player_001",
onSuccess: res =>
{
Debug.Log("플레이어 기록 삭제 성공");
Debug.Log($"상태: {res.Status}");
},
onError: error =>
{
Debug.LogError($"플레이어 기록 삭제 실패: [{error.ErrorCode}] {error.Message}");
}
));
}
삭제 주의사항

삭제된 기록은 복구할 수 없습니다. 삭제 전에 반드시 확인 절차를 거치는 것이 좋습니다.