28 lines
786 B
Dart
28 lines
786 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
import 'api_client.dart';
|
|
|
|
part 'inbox_api.freezed.dart';
|
|
part 'inbox_api.g.dart';
|
|
|
|
@freezed
|
|
abstract class UpdateInboxEntryRequest with _$UpdateInboxEntryRequest {
|
|
const factory UpdateInboxEntryRequest({
|
|
// ignore: non_constant_identifier_names
|
|
required int file_id,
|
|
required int time,
|
|
required String? label,
|
|
required double? amount,
|
|
}) = _UpdateInboxEntryRequest;
|
|
|
|
factory UpdateInboxEntryRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$UpdateInboxEntryRequestFromJson(json);
|
|
}
|
|
|
|
extension InboxApi on ApiClient {
|
|
/// Create a new inbox entry
|
|
Future<void> createInboxEntry(UpdateInboxEntryRequest entry) async {
|
|
await execute("/inbox", method: "POST", data: entry.toJson());
|
|
}
|
|
}
|