데이터 삭제
저장된 게임 데이터를 삭제하는 API입니다.
URL 확인
이 API는 service-storage-api.playnanoo.com 도메인을 사용합니다.
API 정보
- URL:
https://service-storage-api.playnanoo.com/storage/v20230801/delete - Method:
PUT - 인증 필요: 예
DeviceInfo 상속
이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| storage_key | string | 필수 | 삭제할 데이터의 키 |
응답 데이터
Res 클래스
| 필드 | 타입 | 설명 |
|---|---|---|
| Status | string | 처리 상태 |
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 StorageDelete
{
static string path = "https://service-storage-api.playnanoo.com/storage/v20230801/delete";
[Serializable]
public class Req : DeviceInfo
{
public string storage_key;
public IEnumerator Send(string storage_key, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(storage_key)) this.storage_key = storage_key;
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 DeleteGameData()
{
StorageDelete.Req req = new StorageDelete.Req();
StartCoroutine(req.Send(
storage_key: "old_game_data",
onSuccess: res =>
{
Debug.Log("데이터 삭제 성공");
Debug.Log($"상태: {res.Status}");
},
onError: error =>
{
Debug.LogError($"데이터 삭제 실패: [{error.ErrorCode}] {error.Message}");
}
));
}
복구 불가
삭제된 데이터는 복구할 수 없습니다. 중요한 데이터를 삭제하기 전에 사용자에게 확인을 받는 것을 권장합니다.
선택적 삭제
특정 키의 데이터만 삭제됩니다. 여러 데이터를 삭제하려면 각 키에 대해 개별적으로 API를 호출해야 합니다.