재화 전체 조회
플레이어가 보유한 모든 재화 정보를 조회하는 API입니다.
URL 확인
이 API는 service-api.playnanoo.com 도메인을 사용합니다.
API 정보
- URL:
https://service-api.playnanoo.com/currency/v20250301/all - Method:
PUT - 인증 필요: 예
DeviceInfo 상속
이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.
요청 파라미터
이 API는 추가 요청 파라미터가 없습니다.
응답 데이터
Res 클래스
| 필드 | 타입 | 설명 |
|---|---|---|
| items | List<ItemModel> | 재화 목록 |
ItemModel 클래스
| 필드 | 타입 | 설명 |
|---|---|---|
| currency_code | string | 재화 코드 |
| currency_amount | double | 보유 재화 수량 |
Unity C# 구현
BaseResponse 클래스
모든 API 응답의 기본 클래스입니다.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
필드 설명:
ErrorCode: 에러 코드Message: 에러 메시지WithdrawalKey: 탈퇴 유예 상태인 경우 복구에 필요한 키 (탈퇴 유예 중인 계정만 제공)BlockKey: 차단된 계정인 경우 제공되는 키 (차단된 계정만 제공)
ItemModel 클래스
[Serializable]
public class ItemModel
{
public string currency_code;
public double currency_amount;
}
재화 전체 조회 클래스
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Networking;
public class CurrencyAll
{
static string path = "https://service-api.playnanoo.com/currency/v20250301/all";
[Serializable]
public class Req : DeviceInfo
{
public IEnumerator Send(Action<Res> onSuccess, Action<BaseResponse> onError)
{
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public List<ItemModel> items = new List<ItemModel>();
}
[Serializable]
public class ItemModel
{
public string currency_code;
public double currency_amount;
}
}
사용 예제
public void GetAllCurrencies()
{
CurrencyAll.Req req = new CurrencyAll.Req();
StartCoroutine(req.Send(
onSuccess: res =>
{
Debug.Log("재화 전체 조회 성공");
foreach (var item in res.items)
{
Debug.Log($"재화 코드: {item.currency_code}");
Debug.Log($"보유 수량: {item.currency_amount}");
}
},
onError: error =>
{
Debug.LogError($"재화 전체 조회 실패: [{error.ErrorCode}] {error.Message}");
}
));
}
재화 조회
이 API는 플레이어가 보유한 모든 재화를 한 번에 조회합니다. 게임 시작 시 또는 재화 현황을 표시할 때 사용하면 효율적입니다.