create method

Future<Map<String, dynamic>> create({
  1. required String name,
  2. int? expiresInMinutes,
  3. int? maxUses,
  4. List<String>? scopes,
})

Mint a delegated token. token is shown ONCE.

Implementation

Future<Map<String, dynamic>> create({
  required String name,
  int? expiresInMinutes,
  int? maxUses,
  List<String>? scopes,
}) async {
  return (await _http.request(
    'POST',
    '/api-tokens',
    body: {
      'name': name,
      if (expiresInMinutes != null) 'expires_in_minutes': expiresInMinutes,
      if (maxUses != null) 'max_uses': maxUses,
      if (scopes != null) 'scopes': scopes,
    },
  )) as Map<String, dynamic>;
}