Skip to main content

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

ParameterTypeRequiredDescription
table_codestringYesTable code

Response Data

Res Class

FieldTypeDescription
itemsSerializeInbox[]List of inbox items

SerializeInbox Structure

FieldTypeDescription
typestringItem type
item_keystringItem unique key
itemsSerializeItems[]Item detail list
messagesSerializeItemMessages[]Item message list
expire_secintExpiration time (seconds)

SerializeItems Structure

FieldTypeDescription
item_codestringItem code
item_countintItem count

SerializeItemMessages Structure

FieldTypeDescription
languagestringLanguage code
titlestringMessage title
contentstringMessage 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 code
  • Message: Error message
  • WithdrawalKey: 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.