forked from eatvio/eatvio_app
122 lines
3.9 KiB
Dart
122 lines
3.9 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:eatvio_app/features/chat/models/chat_message_model.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/order_id_to_conversation_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/payment/models/promo_applied_list_response.dart';
|
|
import 'package:eatvio_app/features/payment/models/promo_apply_response.dart';
|
|
import 'package:eatvio_app/features/payment/models/promo_remove_response.dart';
|
|
import 'package:eatvio_app/features/payment/models/promo_validate_response.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/v2/chat/index')
|
|
Future<ChatRoomPaginationModel> getChatRooms({
|
|
@Query('page') required int page,
|
|
@Query('filters[data][\$conversation_name]') String? query,
|
|
});
|
|
|
|
@GET('/api/v2/chat/show/{uuid}')
|
|
Future<ChatRoomModel> getChatRoom({
|
|
@Path() required String uuid,
|
|
});
|
|
|
|
@POST('/api/v2/chat/message/send/{slug}')
|
|
@MultiPart()
|
|
Future<ChatMessageModel> sendMessage({
|
|
@Header('X-Socket-ID') required String socketId,
|
|
@Path() required String slug,
|
|
@Part() String? data,
|
|
@Part(name: 'media_data[]', contentType: 'multipart/form-data') List<MultipartFile>? mediaData,
|
|
});
|
|
|
|
@GET('/api/v2/chat/show/{id}/messages?page={page}')
|
|
Future<ChatMessagesModel> getChatMessages({
|
|
@Path() required String id,
|
|
@Path() required int page,
|
|
});
|
|
|
|
@GET('/api/v2/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,
|
|
@Body() required Map<String, String> body,
|
|
});
|
|
|
|
@GET('/api/chosen_plans/applied_promos')
|
|
Future<PromoAppliedListResponse> listAppliedPromoCodes();
|
|
|
|
@POST('/api/chosen_plans/{id}/validate_promo')
|
|
Future<PromoValidateResponse> validatePromoCode({
|
|
@Path() required int id,
|
|
@Body() required Map<String, String> body,
|
|
});
|
|
|
|
@POST('/api/chosen_plans/{id}/apply_promo')
|
|
Future<PromoApplyResponse> applyPromoCode({
|
|
@Path() required int id,
|
|
@Body() required Map<String, String> body,
|
|
});
|
|
|
|
@DELETE('/api/chosen_plans/{id}/remove_promo_code')
|
|
Future<PromoRemoveResponse> removePromoCode({
|
|
@Path() required int id,
|
|
});
|
|
|
|
@GET('/api/consultation/resolve/order_id_to_conversation/{orderId}')
|
|
Future<OrderIdToConversationModel> resolveOrderIdToConversation({
|
|
@Path() required String orderId,
|
|
});
|
|
|
|
@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,
|
|
});
|
|
|
|
@GET('/api/chat/get_by_user/{slug}')
|
|
Future<HttpResponse> getChatByUserSlug({
|
|
@Path() required String slug,
|
|
});
|
|
}
|