api_service.dart 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import 'package:dio/dio.dart' hide Headers;
  2. import 'package:eitc_erm_dental_flutter/entity/clinic_info.dart';
  3. import 'package:eitc_erm_dental_flutter/entity/dict_info.dart';
  4. import 'package:eitc_erm_dental_flutter/entity/login_info.dart';
  5. import 'package:eitc_erm_dental_flutter/entity/patient_info.dart';
  6. import 'package:eitc_erm_dental_flutter/entity/version_info.dart';
  7. import 'package:eitc_erm_dental_flutter/http/api_response.dart';
  8. import 'package:retrofit/retrofit.dart';
  9. part 'api_service.g.dart';
  10. @RestApi()
  11. abstract class ApiService {
  12. factory ApiService(Dio dio, {String? baseUrl}) = _ApiService;
  13. ///登录
  14. ///
  15. /// [phoneNumber] 手机号
  16. @POST("/app/login")
  17. @Headers(<String, dynamic>{
  18. 'Content-Type': 'application/json',
  19. })
  20. Future<ApiResponse<LoginInfo>> login(
  21. @Field("phoneNumber") String phoneNumber);
  22. ///登出
  23. @GET("/app/logout")
  24. Future<ApiResponse<dynamic>> logout(@Header("token") String token);
  25. ///发送验证码
  26. ///
  27. ///[phoneNumber] 手机号
  28. @POST("/app/sendCaptchaCode")
  29. @Headers(<String, dynamic>{
  30. 'Content-Type': 'application/json',
  31. })
  32. Future<ApiResponse<dynamic>> sendCaptchaCode(
  33. @Field("phoneNumber") String phoneNumber);
  34. ///检查验证码
  35. ///
  36. /// [captchaCode] 验证码
  37. ///
  38. /// [phoneNumber] 手机号
  39. @POST("/app/checkCaptchaCode")
  40. @Headers(<String, dynamic>{
  41. 'Content-Type': 'application/json',
  42. })
  43. Future<ApiResponse<dynamic>> checkCaptchaCode(
  44. @Field("captchaCode") String captchaCode,
  45. @Field("phoneNumber") String phoneNumber);
  46. ///获取字典列表
  47. ///
  48. /// [dictType] 字典类型,关系:erm_personal_relationship
  49. @GET("/app/api/type/{dictType}")
  50. Future<ApiResponse<List<DictInfo>>> dictList(
  51. @Path("dictType") String dictType);
  52. ///获取版本信息
  53. ///
  54. /// [type] 类型,android,ios
  55. @GET("/app/api/findVersion")
  56. Future<ApiResponse<VersionInfo>> getVersion(@Query("type") String type);
  57. ///获取咨询人列表
  58. @GET("/app/user/list")
  59. Future<ApiResponse<List<PatientInfo>>> getPatientList();
  60. ///获取诊所列表
  61. @GET("/app/api/clinicList")
  62. Future<ApiResponse<List<ClinicInfo>>> getClinicList();
  63. ///添加咨询人
  64. ///
  65. /// [name] 名字
  66. /// [idCard] 身份证号
  67. /// [relation] 关系
  68. @POST("/app/user")
  69. @Headers(<String, dynamic>{
  70. 'Content-Type': 'application/json',
  71. })
  72. Future<ApiResponse<dynamic>> addPatient(
  73. @Field("patientName") String name,
  74. @Field("identificationCard") String idCard,
  75. @Field("relationship") String relation);
  76. ///隐私政策
  77. @GET("/app/api/privacyPolicy")
  78. Future<HttpResponse<String>> getPrivacyPolicy();
  79. ///用户协议
  80. @GET("/app/api/userAgreement")
  81. @ResponseType.bytes
  82. Future<HttpResponse<String>> getUserAgreement();
  83. ///权限说明
  84. ///
  85. /// [type] 类型,android,ios
  86. @GET("/app/api/permissionDescription")
  87. @ResponseType.bytes
  88. Future<HttpResponse<String>> getPermissionDescription(
  89. @Query("type") String type);
  90. }