초기화
우편함의 아이템을 삭제하는 API입니다.
URL 확인
이 API는 service-api.playnanoo.com 도메인을 사용합니다.
API 정보
- URL:
https://service-api.playnanoo.com/inbox/v20220901/clear - Method:
PUT - 인증 필요: 예
DeviceInfo 상속
이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| table_code | 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 InboxClear
{
static string url = "https://service-api.playnanoo.com/inbox/v20220901/clear";
[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;
// PUT 방식 호출
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
url,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public string status;
}
}
사용 예제
public void ClearInbox()
{
InboxClear.Req req = new InboxClear.Req();
StartCoroutine(req.Send(
tableCode: "inbox_table_01",
onSuccess: res =>
{
Debug.Log($"우편함 아이템 삭제 성공: {res.status}");
},
onError: (error) =>
{
Debug.LogError($"우편함 아이템 삭제 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
주의
이 API는 우편함의 아이템을 삭제합니다. 신중하게 사용하세요.