createArtist method

Future<Artist> createArtist(
  1. String artistName,
  2. String email,
  3. String password, {
  4. bool enabled = true,
  5. bool isReader = true,
  6. bool isWriter = true,
  7. bool isAdmin = false,
})

Creates a new artist

Implementation

Future<Artist> createArtist(
  String artistName,
  String email,
  String password, {
  bool enabled = true,
  bool isReader = true,
  bool isWriter = true,
  bool isAdmin = false,
}) async {
  final roles = <String>[];
  if (isReader) {
    roles.add('ROLE_READER');
  }
  if (isWriter) {
    roles.add('ROLE_WRITER');
  }
  if (isAdmin) {
    roles.add('ROLE_ADMIN');
  }
  final response = await _post('/api/artist', data: {
    'artistName': artistName,
    'email': email,
    'enabled': enabled,
    'password': password,
    'roles': roles,
  });

  return Artist.fromJson(response.data);
}