import 'package:dio/dio.dart'; import 'package:farm_tpf/custom_model/ActionType.dart'; import 'package:farm_tpf/custom_model/CropPlot.dart'; import 'package:farm_tpf/custom_model/Device.dart'; import 'package:farm_tpf/custom_model/EnvironmentParameter.dart'; import 'package:farm_tpf/custom_model/Harvest.dart'; import 'package:farm_tpf/custom_model/LocationUnit.dart'; import 'package:farm_tpf/custom_model/Supply.dart'; import 'package:farm_tpf/custom_model/TbCropDTO.dart'; import 'package:farm_tpf/custom_model/UpdateNoti.dart'; import 'package:farm_tpf/custom_model/WaterType.dart'; import 'package:farm_tpf/custom_model/account.dart'; import 'package:farm_tpf/custom_model/action_form/ActionUIForm.dart'; import 'package:farm_tpf/custom_model/action_form/RequestActivity.dart'; import 'package:farm_tpf/custom_model/password.dart'; import 'package:farm_tpf/custom_model/user.dart'; import 'package:farm_tpf/custom_model/user_request.dart'; import 'package:farm_tpf/utils/const_common.dart'; import 'package:flutter/material.dart'; import 'package:retrofit/retrofit.dart'; part 'rest_client.g.dart'; @RestApi(baseUrl: ConstCommon.baseUrl) abstract class RestClient { factory RestClient(Dio dio) = _RestClient; @POST("/api/authenticate") Future login(@Body() UserRequest userRequest); @GET("/api/account") Future getMe(); @POST("/api/account/reset-password/init") Future forgotPassword(@Body() String email); @POST("/api/account/reset-password/finish") Future resetPassword(@Body() Password password); @POST("/api/account/change-password") Future changePassword(@Body() Password password); @PUT("/api/update-my-profile") Future updateProfile(@Body() Account account); @GET("/api/list-supplies-in-warehouses/{type}?q={query}") Future> getSupplies(@Path() String type, {@DioOptions() Options? options, @Path() String query = ""}); //Common @PUT("/api/update-fcmToken") Future updateFcmToken(@Body() String token); @PUT("/api/delete-fcmToken") Future deleteFcmToken(@Body() String token); //Plot @GET("/api/_search/tb-crops?page={page}&size={size}&sort=id,asc&query={query}") Future> getPlots({@Path() int page = 0, @Path() int size = 20, @Path() String query = ""}); //TODO: check clean code @GET("/api/listActivityTypesOther") Future> getActionTypes({@DioOptions() Options? options}); @GET("/api/water-types") Future> getWaterTypes({@DioOptions() Options? options}); @GET("/api/tb-harvests") Future> getHarvests({@DioOptions() Options? options}); @GET("/api/listDeviceForActivity") Future> getDeviceForActivity({@DioOptions() Options? options}); @PUT("/api/notifications/update-all") Future updateAllNotification(@Body() String status); @PUT("/api/notifications/update") Future updateNoti(@Body() UpdateNoti updateNoti); @GET("/api/tb-countries?page={page}&size={size}&query={query}&&sort=name,ASC") Future> getCountries({@Path() int page = 0, @Path() int size = 400, @Path() String query = '', @DioOptions() Options? options}); @GET("/api/tb-cities-by-country/{countryId}?page={page}&size={size}&query={query}&&sort=name,ASC") Future> getProvinces(@Path() int countryId, {@Path() int page = 0, @Path() int size = 20, @Path() String query = '', @DioOptions() Options? options}); @GET("/api/tb-districts-by-city/{provinceId}?page={page}&size={size}&query={query}&&sort=name,ASC") Future> getDistricts(@Path() int provinceId, {@Path() int page = 0, @Path() int size = 20, @Path() String query = '', @DioOptions() Options? options}); @GET("/api/tb-wards-by-district/{districtId}?page={page}&size={size}&query={query}&&sort=name,ASC") Future> getWards(@Path() int districtId, {@Path() int page = 0, @Path() int size = 20, @Path() String query = '', @DioOptions() Options? options}); //Crop @GET("/api/tb-crops-detail-for-app/{cropId}") Future getCropDetail(@Path() int cropId, {@Path() int page = 0, @Path() int size = 20}); @GET("/api/tb-crops-scan-qrCode/{cropCode}") Future getCropDetailByCode(@Path() String cropCode); @PUT("/api/tb-crops") Future updateCrop(@Body() TbCropDTO crop); //Device @GET("/api/listDeviceOfUserCustomers?query={query}") Future> getDevices(@Path() String query); //Get environment parameter @GET("/api/list-environment-updates-display/{cropId}?page={page}&size={size}") Future> getEnvironmentParameters(@Path() int cropId, {@Path() int page = 0, @Path() int size = 20}); //NEW Activity implement @GET('/api/display-object-param-dynamic-form/{idAction}') Future getActionUIForm(@Path() idAction, @DioOptions() Options? options); @GET('/api/get-detail-common-activity/{actionType}/{activityId}') Future getDetailActivityCommon(@Path() actionType, @Path() activityId); }