authorize method

Future<void> authorize(
  1. String mac,
  2. int minutes, {
  3. int? up,
  4. int? down,
  5. int? megabytes,
  6. String? ap_mac,
  7. String? siteId,
})

Authorize a mac for minutes. up: upload speed in kbps down: download speed in kbps megabytes: data transfer limit in mb ap_mac optional AP's mac

Throw ApiException if not successful

Implementation

Future<void> authorize(String mac, int minutes,
    {int? up,
    int? down,
    int? megabytes,
    String? ap_mac,
    String? siteId}) async {
  var payloads = {
    'mac': mac,
    'minutes': minutes,
    'cmd': Commands.authorize,
  };
  if (up != null) payloads['up'] = up;
  if (down != null) payloads['down'] = down;
  if (megabytes != null) payloads['megabytes'] = megabytes;
  await controller.post(Endpoints.staMgr, payloads, siteId: siteId);
}