Skip to main content
Version: 6.0.0

GetCouponList

public BackndCouponReturnObject GetCouponList();

BackndCouponReturnObject

GetReturnValueByCouponList

If an error occurred, null is returned.

BackndCouponReturnObject bro = Backnd.Coupon.GetCouponList();

foreach(BackndCouponItem item in bro.GetReturnValueByCouponList()) {
Debug.Log(item.ToString());
}

BackndCouponItem

public class BackndCouponItem
{
public string uuid = string.Empty;
public string title = string.Empty;
public string type = string.Empty;
public string version = string.Empty;
public string redundant = string.Empty;
}

Description

Looks up the list of coupons registered in BACKND Console.

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

Example

Synchronous

Backnd.Coupon.GetCouponList();

Asynchronous

Backnd.Coupon.GetCouponList((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 GetCouponListTest()
{
var bro = Backnd.Coupon.GetCouponList();

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

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

BACKND.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");
}
}