Skip to main content

Consume Multiple Items

API to consume multiple items from the inbox at once.

URL Confirmation

This API uses the service-api.playnanoo.com domain.

API Information

  • URL: https://service-api.playnanoo.com/inbox/v20220901/consume/multi
  • 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
item_keysstringYesItem keys to consume (comma-separated string, e.g., "key1,key2,key3")

Response Data

Res Class

FieldTypeDescription
itemsSerializeItems[]List of consumed items

SerializeItems Structure

FieldTypeDescription
item_codestringItem code
item_countintItem count

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 Multiple Items Consume Class

using System;
using System.Collections;
using UnityEngine.Networking;

public class InboxConsumeMultiItem
{
static string url = "https://service-api.playnanoo.com/inbox/v20220901/consume/multi";

[Serializable]
public class Req : DeviceInfo
{
//string item_keys = key[0],key[1],key[2];
public string item_keys;

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

// 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 SerializeItems[] items;
}

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

Usage Example

public void ConsumeMultipleInboxItems()
{
InboxConsumeMultiItem.Req req = new InboxConsumeMultiItem.Req();

// Create item keys as a comma-separated string
string itemKeys = "item_key_12345,item_key_67890,item_key_abcde";

StartCoroutine(req.Send(
item_keys: itemKeys,
onSuccess: res =>
{
Debug.Log("Multiple inbox items consumption successful");
if (res.items != null)
{
foreach (var item in res.items)
{
Debug.Log($"Item: {item.item_code}, Count: {item.item_count}");
}
}
},
onError: (error) =>
{
Debug.LogError($"Multiple inbox items consumption failed: [{error.ErrorCode}] [{error.Message}]");
}
));
}
Item Keys Format

item_keys is a comma-separated string format. Example: "key1,key2,key3"