1
0
mirror of https://github.com/go-vikunja/app synced 2024-05-31 17:57:14 +00:00
app-mirror-github/lib/api/label_task_bulk.dart
Denys Vitali 056b2d72c9
chore: format code with dart format (#71)
This PR formats all code with dart format and adds a step to the CI so that it will be checked on every push and PR.
2024-04-05 22:36:56 +02:00

25 lines
859 B
Dart

import 'package:vikunja_app/api/client.dart';
import 'package:vikunja_app/api/service.dart';
import 'package:vikunja_app/models/label.dart';
import 'package:vikunja_app/models/labelTaskBulk.dart';
import 'package:vikunja_app/models/task.dart';
import 'package:vikunja_app/service/services.dart';
class LabelTaskBulkAPIService extends APIService
implements LabelTaskBulkService {
LabelTaskBulkAPIService(Client client) : super(client);
@override
Future<List<Label>?> update(Task task, List<Label>? labels) {
if (labels == null) labels = [];
return client
.post('/tasks/${task.id}/labels/bulk',
body: LabelTaskBulk(labels: labels).toJSON())
.then((response) {
if (response == null) return null;
return convertList(
response.body['labels'], (result) => Label.fromJson(result));
});
}
}