requestToken method

Future<Token> requestToken(
  1. String username,
  2. String email,
  3. String password,
  4. bool agreement,
  5. String locale,
)
inherited

POST /api/v1/accounts

  • authenticated (no user required)
  • write write:accounts

Implementation

Future<Token> requestToken(
  String username,
  String email,
  String password,
  bool agreement,
  String locale,
) async {
  final response = await request(
    Method.post,
    "/api/v1/accounts",
    authenticated: true,
    payload: {
      "username": username,
      "email": email,
      "password": password,
      "agreement": agreement.toString(),
      "locale": locale,
    },
  );

  return Token.fromJson(json.decode(response.body));
}