Can upload expenses to server
This commit is contained in:
		
							
								
								
									
										27
									
								
								moneymgr_mobile/lib/services/api/inbox_api.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								moneymgr_mobile/lib/services/api/inbox_api.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
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());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user