Item List
API to query the list of items in the inbox.
URL Confirmation
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/inbox/v20220901/items - Method:
PUT - Authentication Required: Yes
DeviceInfo Inheritance
The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| table_code | string | Yes | Table code |
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| items | SerializeInbox[] | List of inbox items |
SerializeInbox Structure
| Field | Type | Description |
|---|---|---|
| type | string | Item type |
| item_key | string | Item unique key |
| items | SerializeItems[] | Item detail list |
| messages | SerializeItemMessages[] | Item message list |
| expire_sec | int | Expiration time (seconds) |
SerializeItems Structure
| Field | Type | Description |
|---|---|---|
| item_code | string | Item code |
| item_count | int | Item count |
SerializeItemMessages Structure
| Field | Type | Description |
|---|---|---|
| language | string | Language code |
| title | string | Message title |
| content | string | Message content |
Unity C# Implementation
BaseResponse Class
Base class for all API responses.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
Field descriptions:
ErrorCode: Error codeMessage: Error messageWithdrawalKey: Key required for recovery if account is in withdrawal grace period (provided only for accounts in withdrawal grace period)BlockKey: Key provided for blocked accounts (provided only for blocked accounts)
Inbox Item List Query Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class InboxItems
{
static string url = "https://service-api.playnanoo.com/inbox/v20220901/items";
[Serializable]
public class Req : DeviceInfo
{
public string table_code;
public IEnumerator Send(
string table_code,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.table_code = table_code;
// PUT method call
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
url,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public SerializeInbox[] items;
}
[Serializable]
public class SerializeInbox
{
public string type;
public string item_key;
public SerializeItems[] items;
public SerializeItemMessages[] messages;
public int expire_sec;
}
[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;
}
}
Usage Example
public void GetInboxItems()
{
InboxItems.Req req = new InboxItems.Req();
StartCoroutine(req.Send(
table_code: "inbox_table_01",
onSuccess: res =>
{
Debug.Log("Inbox item list query successful");
if (res.items != null)
{
foreach (var inbox in res.items)
{
Debug.Log($"Item Key: {inbox.item_key}, Type: {inbox.type}, Expires: {inbox.expire_sec} seconds");
if (inbox.items != null)
{
foreach (var item in inbox.items)
{
Debug.Log($" - {item.item_code}: {item.item_count} units");
}
}
if (inbox.messages != null)
{
foreach (var msg in inbox.messages)
{
Debug.Log($" Message[{msg.language}]: {msg.title} - {msg.content}");
}
}
}
}
},
onError: (error) =>
{
Debug.LogError($"Inbox item list query failed: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Table Code
table_code is the code of the inbox table created in the PlayNANOO console.