Skip to content

API Reference

Sylvia Huang [SSW] edited this page May 14, 2023 · 12 revisions

login 登录

Description

  • Get and return one user based on current user openid. Create and return the user if it does not exist.

Parameters

None

Return

{
  "id": "000000",
  "name": "meeple000000",
  "alias": null,
  "roles": [
    "user"
  ],
  "balance": 0,
  "wallet": [
    {
      "id": "1683692161422",
      "type": "guest",
      "activation": "2023-05-10T04:16:01.422Z",
      "expiration": null,
      "balance": null
    }
  ]
}

user 用户

getUserById

Description

  • Get and one user based on user id

Parameters

{
  "action": "getUserById",
  "data": {
    "id": "000000",
  }
}

Return

{
  "id": String,
  "name": String,
  "alias": String,
  "roles": Array[String],
  "balance": Number,
  "wallet": Array[Card {
    "id": String,
    "type": String,
    "activation": Date,
    "expiration": Date,
    "balance": Number
  }]
}

updateUserInfo

Description

  • Update a user's basic info given id.

Parameters

{
  "action": "updateUserInfo",
  "data": {
    "id": "000000",
    "balance": -10
  }
}

Return

{
  "id": "000000",
  "name": "meeple000000",
  "balance": -10
}

card 卡

addCardByType

Description

  • Add a card to a user's wallet.

Parameters

{
  "action": "addCardByType",
  "data": {
    "id": "000000",
    "cardType": "seasonal" #"annual", "times"
  }
}

Return

{
  "id": String,
  "wallet": Array[Card {
    "id": String,
    "type": String,
    "activation": Date,
    "expiration": Date,
    "balance": Number
  }]
}

removeCardById

Description

  • Remove a card from a user's wallet.

Parameters

{
  "action": "removeCardById",
  "data": {
    "id": "000000",
    "cardId": "1683641095812"
  }
}

Return

{
  "id": String,
  "wallet": Array[Card {
    "id": String,
    "type": String,
    "activation": Date,
    "expiration": Date,
    "balance": Number
  }]
}

activateCardById

Description

  • Activate a card from a user's wallet. Note: only seasonal card can be activated at this time.

Parameters

{
  "action": "activateCardById",
  "data": {
    "id": "000000",
    "cardId": "1683641095812"
  }
}

Return

{
   "id": String,
   "type": String,
   "activation": Date,
   "expiration": Date,
   "balance": Number
}

chargeCardById

Description

  • Charge a card given card id based on today's date.

Parameters

{
  "action": "chargeCardById",
  "data": {
    "id": "000000",
    "cardId": "1683641095812"
  }
}

Return

{
   "id": String,
   "type": String,
   "activation": Date,
   "expiration": Date,
   "balance": Number
}

getValidCards

Description

  • Get a list of valid cards for a user, including ones activate-able.

Parameters

{
  "action": "getValidCards",
  "data": {
    "id": "000000"
  }
}

Return

Array[Card {
   "id": String,
   "type": String,
   "activation": Date,
   "expiration": Date,
   "balance": Number
}]

checkin 签到

getCheckInStatus

Description

  • Get user's checkin status today.

Parameters

{
  "action": "getCheckInStatus",
  "data": {
    "id": "000000"
  }
}

Return

{
  "isCheckedIn": Boolean,
  "cardId": String,
}

checkin

Description

  • Check in a user today with given card. This will automatically create a new visit record for this user and charge the card or user depending on card and date.

Parameters

{
  "action": "checkin",
  "data": {
    "id": String,
    "cardId": String
  }
}

Return

{
  "id": String,
  "cardId": String,
  "userId": String,
  "date": Date
}
Clone this wiki locally