Item Count
API to query the number 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/count - 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 |
|---|---|---|
| count | int | Number of inbox items |
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 Count Query Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class InboxCount
{
static string url = "https://service-api.playnanoo.com/inbox/v20220901/count";
[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 int count;
}
}
Usage Example
public void GetInboxCount()
{
InboxCount.Req req = new InboxCount.Req();
StartCoroutine(req.Send(
table_code: "inbox_table_01",
onSuccess: res =>
{
Debug.Log($"Inbox item count: {res.count}");
},
onError: (error) =>
{
Debug.LogError($"Inbox item count query failed: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Table Code
table_code is the code of the inbox table created in the PlayNANOO console.