createBoard method
Implementation
Future<MondayBoard> createBoard(MondayBoard board) async {
final mutation = '''
mutation {
create_board(
board_name: "${board.name}",
board_kind: private
) {
id
name
state
owner {
id
name
}
}
}
''';
final responseJson = await postQuery(mutation);
final createdBoardJson =
responseJson['data']['create_board'] as Map<String, dynamic>;
final createdBoardId = createdBoardJson['id'] as String;
for (var col in board.columns) {
print('Creating column ${col.title} type ${col.type}');
await createColumn(
boardId: createdBoardId,
title: col.title,
type: col.type,
);
print("Created Column ${col.title}");
}
final newBoard = await getBoard(createdBoardId);
return newBoard;
}