forked from eatvio/eatvio_app
84 lines
2.4 KiB
Dart
84 lines
2.4 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:eatvio_app/features/chat/models/chat_messages_model.dart';
|
|
import 'package:eatvio_app/features/chat/models/chat_room_model.dart';
|
|
import 'package:eatvio_app/features/chat/models/chat_room_pagination_model.dart';
|
|
import 'package:eatvio_app/features/chat/models/payment_model.dart';
|
|
import 'package:eatvio_app/features/chat/models/plan_complain_model.dart';
|
|
import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart';
|
|
import 'package:retrofit/retrofit.dart';
|
|
|
|
part 'chat_service.g.dart';
|
|
|
|
@RestApi()
|
|
abstract class ChatService {
|
|
factory ChatService(Dio dio, {String baseUrl}) = _ChatService;
|
|
|
|
@GET('/api/chat/index')
|
|
Future<ChatRoomPaginationModel> getChatRooms({
|
|
@Query('page') required int page,
|
|
@Query('find') String? query,
|
|
});
|
|
|
|
@GET('/api/chat/show/{id}')
|
|
Future<Map<String, ChatRoomModel>> getChatRoom({
|
|
@Path() required String id,
|
|
});
|
|
|
|
@POST('/api/chat/{id}/message/send')
|
|
@MultiPart()
|
|
Future<void> sendMessage({
|
|
@Path() required String id,
|
|
@Part() String? data,
|
|
@Part(name: 'media_data[]', contentType: 'multipart/form-data') List<MultipartFile>? mediaData,
|
|
});
|
|
|
|
@GET('/api/chat/show/{id}/messages?page={page}')
|
|
Future<ChatMessagesModel> getChatMessages({
|
|
@Path() required String id,
|
|
@Path() required int page,
|
|
});
|
|
|
|
@GET('/api/chat/get_by_user/{user}')
|
|
Future<ChatRoomModel> getChatRoomIdByUserSlug({
|
|
@Path() required String user,
|
|
});
|
|
|
|
@POST('/api/chat/{id}/messages/markAsRead')
|
|
Future<void> markMessagesAsRead({
|
|
@Path() required String id,
|
|
@Body() required Map<String, List<int>> body,
|
|
});
|
|
|
|
@POST('/api/chosen_plans/{id}/cancel')
|
|
Future<void> cancelChosenPlan({
|
|
@Path() required int id,
|
|
});
|
|
|
|
@POST('/api/chosen_plans/{id}/negotiate_contract_start')
|
|
Future<void> choseStartPlanDate({
|
|
@Path() required int id,
|
|
@Body() required Map<String, String> date,
|
|
});
|
|
|
|
@POST('/api/chosen_plans/{id}/start_payment_process')
|
|
Future<PaymentModel> getPaymentLink({
|
|
@Path() required int id,
|
|
});
|
|
|
|
@GET('/api/chosen_plans/show/{id}')
|
|
Future<ChosenPlanModel> getChosenPlan({
|
|
@Path() required int id,
|
|
});
|
|
|
|
@POST('/api/chosen_plans/{id}/confirm_finish')
|
|
Future<void> finishChosenPlan({
|
|
@Path() required int id,
|
|
});
|
|
|
|
@POST('/api/chosen_plans/{id}/complain')
|
|
Future<void> complainAboutConsultation({
|
|
@Path() required int id,
|
|
@Body() required PlanComplainModel body,
|
|
});
|
|
}
|