Send Item
API to send items via inbox.
URL Confirmation
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/inbox/v20220901/send - 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 |
| items | string | Yes | Item data to send (JSON string) |
| period | int | Required | Validity period (in days) |
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| status | string | Processing status |
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 Send Class
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class InboxSendItem
{
static string url = "https://service-api.playnanoo.com/inbox/v20220901/send";
[Serializable]
public class Req : DeviceInfo
{
public string table_code;
// string items = JsonUtility.ToJson(SerializePost items)
public string items;
public int period;
public IEnumerator Send(
string table_code,
string items,
int period,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.table_code = table_code;
if (!string.IsNullOrEmpty(items)) this.items = items;
this.period = period;
// 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 string status;
}
[Serializable]
public class SerializePost
{
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;
}
// Add this to your shared configuration data.
public class InboxConfigure
{
public static readonly string PN_LANG_CODE_DEFAULT = "default";
public static readonly string PN_LANG_CODE_AF = "AF";
public static readonly string PN_LANG_CODE_AR = "AR";
public static readonly string PN_LANG_CODE_EU = "EU";
public static readonly string PN_LANG_CODE_BE = "BE";
public static readonly string PN_LANG_CODE_BG = "BG";
public static readonly string PN_LANG_CODE_CA = "CA";
public static readonly string PN_LANG_CODE_CN = "zh-CN";
public static readonly string PN_LANG_CODE_TW = "zh-TW";
public static readonly string PN_LANG_CODE_CS = "CS";
public static readonly string PN_LANG_CODE_DA = "DA";
public static readonly string PN_LANG_CODE_NL = "NL";
public static readonly string PN_LANG_CODE_EN = "EN";
public static readonly string PN_LANG_CODE_ET = "ET";
public static readonly string PN_LANG_CODE_FO = "FO";
public static readonly string PN_LANG_CODE_FI = "FI";
public static readonly string PN_LANG_CODE_FR = "FR";
public static readonly string PN_LANG_CODE_DE = "DE";
public static readonly string PN_LANG_CODE_EL = "EL";
public static readonly string PN_LANG_CODE_IW = "IW";
public static readonly string PN_LANG_CODE_HU = "HU";
public static readonly string PN_LANG_CODE_IS = "IS";
public static readonly string PN_LANG_CODE_IN = "IN";
public static readonly string PN_LANG_CODE_IT = "IT";
public static readonly string PN_LANG_CODE_JA = "JA";
public static readonly string PN_LANG_CODE_KO = "KO";
public static readonly string PN_LANG_CODE_LV = "LV";
public static readonly string PN_LANG_CODE_LT = "LT";
public static readonly string PN_LANG_CODE_NO = "NO";
public static readonly string PN_LANG_CODE_PL = "PN";
public static readonly string PN_LANG_CODE_PT = "PT";
public static readonly string PN_LANG_CODE_RO = "RO";
public static readonly string PN_LANG_CODE_RU = "RU";
public static readonly string PN_LANG_CODE_SH = "SH";
public static readonly string PN_LANG_CODE_SK = "SK";
public static readonly string PN_LANG_CODE_SL = "SL";
public static readonly string PN_LANG_CODE_ES = "ES";
public static readonly string PN_LANG_CODE_SV = "SV";
public static readonly string PN_LANG_CODE_TH = "TH";
public static readonly string PN_LANG_CODE_TR = "TR";
public static readonly string PN_LANG_CODE_UK = "UK";
public static readonly string PN_LANG_CODE_VI = "VI";
}
}
Usage Example
public void SendInboxItem()
{
InboxSendItem.Req req = new InboxSendItem.Req();
// Construct item data
InboxSendItem.SerializePost postData = new InboxSendItem.SerializePost
{
items = new InboxSendItem.SerializeItems[]
{
new InboxSendItem.SerializeItems { item_code = "gold", item_count = 1000 },
new InboxSendItem.SerializeItems { item_code = "diamond", item_count = 50 }
},
messages = new InboxSendItem.SerializeItemMessages[]
{
new InboxSendItem.SerializeItemMessages
{
language = InboxSendItem.InboxConfigure.PN_LANG_CODE_KO,
title = "Reward",
content = "Event reward."
},
new InboxSendItem.SerializeItemMessages
{
language = InboxSendItem.InboxConfigure.PN_LANG_CODE_EN,
title = "Reward",
content = "Event reward."
}
}
};
// Convert to JSON string
string itemsJson = JsonUtility.ToJson(postData);
StartCoroutine(req.Send(
table_code: "inbox_table_01",
items: itemsJson,
period: 7, // 7 days (in days)
onSuccess: res =>
{
Debug.Log($"Inbox item sent successfully: {res.status}");
},
onError: (error) =>
{
Debug.LogError($"Inbox item send failed: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Validity Period
period is specified in days. For example, enter 7 for a 7-day validity period.
Language Codes
You can set multilingual messages using the language codes defined in the InboxConfigure class.