Get Currency
API to query the amount of a specific currency owned.
URL Verification
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/currency/v20250301/get - 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 |
|---|---|---|---|
| currency_code | string | Required | Currency code to query |
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| currency_amount | double | Currency amount owned |
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)
Get Currency Class
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Networking;
public class CurrencyGet
{
static string path = "https://service-api.playnanoo.com/currency/v20250301/get";
[Serializable]
public class Req : DeviceInfo
{
public string currency_code;
public IEnumerator Send(string currencyCode, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(currencyCode)) this.currency_code = currencyCode;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public double currency_amount;
}
}
Usage Example
public void GetCurrency()
{
CurrencyGet.Req req = new CurrencyGet.Req();
StartCoroutine(req.Send(
currencyCode: "GOLD",
onSuccess: res =>
{
Debug.Log("Get currency successful");
Debug.Log($"GOLD owned: {res.currency_amount}");
},
onError: error =>
{
Debug.LogError($"Get currency failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Currency Query
Query the current amount owned of a specific currency by specifying the currency code.