requestSMSCode static method

Future requestSMSCode(
  1. String mobile, {
  2. String? template,
  3. String? signature,
  4. String? captchaToken,
  5. Map<String, dynamic>? variables,
})

Requests an SMS code for operation verification.

Implementation

static Future requestSMSCode(String mobile,
    {String? template,
    String? signature,
    String? captchaToken,
    Map<String, dynamic>? variables}) async {
  String path = 'requestSmsCode';
  Map<String, dynamic> data = {'mobilePhoneNumber': mobile};
  if (template != null) {
    data['template'] = template;
  }
  if (signature != null) {
    data['sign'] = signature;
  }
  if (captchaToken != null) {
    data['validate_token'] = captchaToken;
  }
  if (variables != null) {
    variables.forEach((k, v) {
      data[k] = v;
    });
  }
  await LeanCloud._httpClient.post(path, data: data);
}