跳转到主要内容

物品详情

用于查询邮箱中特定物品详细信息的 API。

URL 确认

此 API 使用 service-api.playnanoo.com 域名。

API 信息

  • URL: https://service-api.playnanoo.com/inbox/v20220901/show
  • Method: PUT
  • 需要认证: 是
DeviceInfo 继承

此 API 的 Req 类继承自 DeviceInfo。DeviceInfo 的所有属性会自动包含。

请求参数

参数类型必填说明
item_keystring必填要查询的物品键

响应数据

Res 类

字段类型说明
itemsSerializeItems[]物品列表
messagesSerializeItemMessages[]消息列表

SerializeItems 结构

字段类型说明
item_codestring物品代码
item_countint物品数量

SerializeItemMessages 结构

字段类型说明
languagestring语言代码
titlestring消息标题
contentstring消息内容

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 InboxShow
{
static string url = "https://service-api.playnanoo.com/inbox/v20220901/show";

[Serializable]
public class Req : DeviceInfo
{
public string item_key;

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

// PUT 방식 호출
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
url,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}

[Serializable]
public class Res : BaseResponse
{
public SerializeItems[] items;
public SerializeItemMessages[] messages;
}

[Serializable]
public class SerializeItems
{
public string item_code;
public int item_count;
}

[Serializable]
public class SerializeItemMessages
{
public string language;
public string title;
public string content;
}
}

使用示例

public void ShowInboxItem()
{
InboxShow.Req req = new InboxShow.Req();

StartCoroutine(req.Send(
item_key: "item_key_12345",
onSuccess: res =>
{
Debug.Log("우편함 아이템 상세 조회 성공");

if (res.items != null)
{
foreach (var item in res.items)
{
Debug.Log($"아이템: {item.item_code}, 개수: {item.item_count}");
}
}

if (res.messages != null)
{
foreach (var msg in res.messages)
{
Debug.Log($"메시지[{msg.language}]: {msg.title} - {msg.content}");
}
}
},
onError: (error) =>
{
Debug.LogError($"우편함 아이템 상세 조회 실패: [{error.ErrorCode}] [{error.Message}]");
}
));
}
物品键

item_key 是通过邮箱物品列表查询 API 返回的物品唯一键。