Skip to main content
Version: 5.11.4

CouponList

public BackendReturnObject CouponList();

Description

Looks up the list of coupons registered in BACKND Console.

  • You can look up both new and old version coupons.

Example

Synchronous

Backend.Coupon.CouponList();

Asynchronous

Backend.Coupon.CouponList((callback) =>
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Coupon.CouponList, (callback) =>
{
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

GetReturnValuetoJSON

{
rows: [
{
// Coupon uuid
uuid: "296",
// Coupon name
title: "Coupon name",
// Coupon type(serial/single)
type: "serial",
// Version information(new/old)
version: "new"
// Duplicate use(Allow: y, Does not allow: n)
redundant: "n"
},
{
uuid: [String],
title: [String],
type: [String],
version: [String],
redundant: [String]
},
...
];
}

Sample code

public class Coupon
{
public string uuid; // Coupon ID
public string title; // Coupon name
public string type;// Serial/coupon
public string version; // Whether it is a new version
public string redundant; // Whether the coupon allows duplicate use
public override string ToString()
{
return $"title: {title}\n" +
$"uuid: {uuid}\n" +
$"type: {type}\n" +
$"version: {version}\n" +
$"redundant: {redundant}";
}
}
public void CouponListTest()
{
var bro = Backend.Coupon.CouponList();

if(!bro.IsSuccess())
{
Debug.LogError("An error occurred : " + bro.ToString());
return;
}

List<Coupon> couponList = new List<Coupon>();

LitJson.JsonData json = bro.FlattenRows();

for(int i = 0; i < json.Count; i++)
{
Coupon coupon = new Coupon();

coupon.title = json[i]["title"].ToString();
coupon.uuid = json[i]["uuid"].ToString();
coupon.type = json[i]["type"].ToString();
coupon.version = json[i]["version"].ToString();
coupon.redundant = json[i]["redundant"].ToString();

couponList.Add(coupon);
}

foreach(var coupon in couponList)
{
Debug.Log(coupon.ToString() + "\n");
}
}